The document contains 3 SQL queries and results from the SAKILA sample database:
1) The first query displays the number of films in each category and returns 16 rows.
2) The second query calculates the total payment amount by customers in August 2005 and returns 1 row.
3) The third query lists the film titles rented by the customer "MARY SMITH" in August 2005 and returns 10 rows.
1 of 2
Downloaded 14 times
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: