From 656635366ae2a245d68731a4d505160ab5354eb7 Mon Sep 17 00:00:00 2001 From: Priyanka Marmath Date: Wed, 17 Sep 2025 20:53:38 +0200 Subject: [PATCH] solved lab --- .DS_Store | Bin 0 -> 6148 bytes solution.sql | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+) create mode 100644 .DS_Store create mode 100644 solution.sql diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..123ac576f560497736cfed8365ef14a54ec312af GIT binary patch literal 6148 zcmeHKyH3ME5S)b+K~SWmyf28vA2^Xyq@aNxKp_p1!HPn9cPaAGF#7=67+MP0m3HTD zZ^vg(;k^SO%ft2tm;sp56>-!sHeFXA*;!;1#h!7C73O%xcHNAszfUOl0(aysP@~6h zA2&_A;i|scf70~}fp(|E_oumCa81(qA>k~yaj_oc%EHSSFJ4de2#HmE5N?b9- z>CBg?s{%Vmr$cOKJ|}jTxS@#c&U~?QNadI@6-Wh!3Y`0Nru~0K|Ka{WB;_m>NCp0s z0y3%Z>m@%adh6)pwAU8;1O3BTYvl}sLjWh*im!WhMaQhG0y{^eGjDWa9t2dEv{c|X G6nF>i7bsl- literal 0 HcmV?d00001 diff --git a/solution.sql b/solution.sql new file mode 100644 index 0000000..7570ebb --- /dev/null +++ b/solution.sql @@ -0,0 +1,53 @@ +use sakila; +show full tables; -- Display all available tables in the Sakila database. +SELECT COUNT(*) FROM film; +SELECT COUNT(*) FROM film_text; +-- ========= +-- Retrieve all the data from the tables actor, film and customer. +select * from actor; +select * from film; +select * from customer; + +-- Retrieve the following columns from their respective tables: + +-- 3.1 Titles of all films from the film table +SELECT title from film; +-- 3.2 List of languages used in films, with the column aliased as language from the language table +SELECT name as Language from language; +-- 3.3 List of first names of all employees from the staff table +select * from staff; +SELECT first_name from staff; + +-- Retrieve unique release years. +SELECT DISTINCT(release_year) from film; + +-- Counting records for database insights: + +-- 5.1 Determine the number of stores that the company has. +select * from store; +select count(store_id) from sakila.store; +-- 5.2 Determine the number of employees that the company has. +select count(staff_id) from sakila.staff; + +-- 5.3 Determine how many films are available for rent and how many have been rented. +select * from inventory; +select * from rental; +select count(distinct(film_id)) from sakila.inventory; +-- 5.4 Determine the number of distinct last names of the actors in the database. +select distinct(last_name) from sakila.actor; + -- Retrieve the 10 longest films. +select title from sakila.film +order by length desc +limit 10; + +-- 7.1 Retrieve all actors with the first name "SCARLETT". +select * from sakila.actor +where first_name = 'SCARLETT'; + +-- 7.2 Retrieve all movies that have ARMAGEDDON in their title and have a duration longer than 100 minutes. +SELECT title FROM sakila.film +WHERE title LIKE '%ARMAGEDDON%' and length > 100; + +-- 7.3 Determine the number of films that include Behind the Scenes content +SELECT count(title) FROM sakila.film +WHERE special_features LIKE '%Behind the Scenes%'; \ No newline at end of file