ݺߣ

ݺߣShare a Scribd company logo
ContohSoalPraktikumSistem Basis Data (SAKILA)

SOAL   : Tampilkanjenis-jenisataukategori film danberapajumlah film padamasing-masingkategori

QUERY : SELECT name AS “KATEGORY FILM”, count(name) as “JUMLAH FILM”
      FROM category JOIN film_category ON category.category_id = film_category.category_id
      GROUP BY (name);

JUMLAH BARIS : 16




SCREENSHOT     :



SOAL   : Berapa total pembayaran (payment) oleh customer padabulan 8 (agustus) 2005

QUERY : SELECT SUM(amount) AS “total pembayaranoleh customer selamabulanagustus 2005”
      FROM payment
      JOIN customer
      ONcustomer.customer_id = payment.customer_id
      WHERE MONTH(payment_date ) =08
      AND YEAR(payment_date ) =2005;

JUMLAH BARIS : 1
SCREENSHOT :
SOAL : Tampilkanjudul film-film apasaja yang dipinjamoleh customer yang
       mempunyainamalengkapMARY SMITH selamabulan 8 (agustus) 2005

QUERY :SELECT DISTINCT title AS "Judul film yang dipinjammary smith selamabulanagustus 2005"
       FROM customer, inventory, film, rental
       WHERE CONCAT_WS( " ", first_name, last_name ) = "MARY SMITH"
       AND MONTH(rental_date ) =08
       AND YEAR(rental_date ) =2005
       AND customer.customer_id = rental.customer_id
       AND inventory.inventory_id = rental.inventory_id
       AND inventory.film_id = film.film_id;

JUMLAH BARIS : 10
SCREENSHOT:

More Related Content

Sistem basis data my sql (sakila)

  • 1. ContohSoalPraktikumSistem Basis Data (SAKILA) SOAL : Tampilkanjenis-jenisataukategori film danberapajumlah film padamasing-masingkategori QUERY : SELECT name AS “KATEGORY FILM”, count(name) as “JUMLAH FILM” FROM category JOIN film_category ON category.category_id = film_category.category_id GROUP BY (name); JUMLAH BARIS : 16 SCREENSHOT : SOAL : Berapa total pembayaran (payment) oleh customer padabulan 8 (agustus) 2005 QUERY : SELECT SUM(amount) AS “total pembayaranoleh customer selamabulanagustus 2005” FROM payment JOIN customer ONcustomer.customer_id = payment.customer_id WHERE MONTH(payment_date ) =08 AND YEAR(payment_date ) =2005; JUMLAH BARIS : 1 SCREENSHOT :
  • 2. SOAL : Tampilkanjudul film-film apasaja yang dipinjamoleh customer yang mempunyainamalengkapMARY SMITH selamabulan 8 (agustus) 2005 QUERY :SELECT DISTINCT title AS "Judul film yang dipinjammary smith selamabulanagustus 2005" FROM customer, inventory, film, rental WHERE CONCAT_WS( " ", first_name, last_name ) = "MARY SMITH" AND MONTH(rental_date ) =08 AND YEAR(rental_date ) =2005 AND customer.customer_id = rental.customer_id AND inventory.inventory_id = rental.inventory_id AND inventory.film_id = film.film_id; JUMLAH BARIS : 10 SCREENSHOT: