From d80e5ca35e406101e6d933c0b4ce4acc8208d2cf Mon Sep 17 00:00:00 2001 From: titijoli2-ai Date: Sun, 5 Jul 2026 07:29:13 +0200 Subject: [PATCH 1/2] Add files via upload --- basic_queries.sql | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 basic_queries.sql diff --git a/basic_queries.sql b/basic_queries.sql new file mode 100644 index 0000000..e69de29 From f389195b91a7dfede2bb39f236b19b0278790e62 Mon Sep 17 00:00:00 2001 From: titijoli2-ai Date: Sun, 5 Jul 2026 08:42:56 +0200 Subject: [PATCH 2/2] Fix SQL queries This SQL file contains basic queries for the Sakila database, including retrieving data from various tables and counting records. --- basic_queries.sql | 96 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 96 insertions(+) diff --git a/basic_queries.sql b/basic_queries.sql index e69de29..0c23e2c 100644 --- a/basic_queries.sql +++ b/basic_queries.sql @@ -0,0 +1,96 @@ +-- LAB | SQL Basic Queries +USE sakila; +-- Question 1: Display all available tables +SHOW TABLES; + +-- Question 2: Retrieve all data from actor, film and customer +SELECT * FROM actor; + +SELECT * FROM film; + +SELECT * FROM customer; + +-- Question 3.1: Titles of all films +SELECT title +FROM film; + +-- Question 3.2: Languages used in films +SELECT name AS language +FROM language; + +-- Question 3.3: First names of all employees +SELECT first_name +FROM staff; + +-- Question 4: Retrieve unique release years +SELECT DISTINCT release_year +FROM film; + +-- Question 5.1: Number of stores +SELECT COUNT(*) as number_of_store +FROM store; + +-- Question 5.2: Number of employees +SELECT count(*) AS number_of_employee +FROM staff; + +-- Question 5.3.1: Number of films available for rent +SELECT COUNT(*) AS films_available +FROM inventory; + +-- Question 5.3.2: Number of films that have been rented +SELECT COUNT(*) AS films_rented +FROM rental; + +-- Question 5.4: Number of distinct actor last names +SELECT COUNT(DISTINCT last_name) AS distinct_last_names +FROM actor; + +-- Question 6: Retrieve the 10 longest films +SELECT title, length +FROM film +ORDER BY length DESC +LIMIT 10; + +-- Question 7.1: Actors named SCARLETT +SELECT * +FROM actor +WHERE first_name = 'SCARLETT'; + +-- Bonus 7.2: ARMAGEDDON movies longer than 100 minutes +SELECT title, length +FROM film +WHERE title like '%ARMAGEDDON%' +AND length>100; + +-- Bonus 7.3: Films with Behind the Scenes content +SELECT COUNT(*) AS behind_the_scenes_films +FROM film +WHERE special_features LIKE '%Behind the scenes%'; + + + + + + + + + + + + + + + + + + + + + + + + + + +