From d09a878a0790d679f27e69fc9730eead073984e2 Mon Sep 17 00:00:00 2001 From: Orgo4ever <163662002+Orgo4ever@users.noreply.github.com> Date: Tue, 7 Jul 2026 14:54:15 +0200 Subject: [PATCH] Create LAB_SQL_Basic_Queries.sql Solved Lab --- LAB_SQL_Basic_Queries.sql | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 LAB_SQL_Basic_Queries.sql diff --git a/LAB_SQL_Basic_Queries.sql b/LAB_SQL_Basic_Queries.sql new file mode 100644 index 0000000..7f85c82 --- /dev/null +++ b/LAB_SQL_Basic_Queries.sql @@ -0,0 +1,36 @@ +USE Sakila; +--- Display all available tables in the Sakila database. +SHOW TABLES FROM sakila; +--- Retrieve all the data from the tables actor, film and customer. +SELECT * FROM actor; +SELECT * FROM film; +SELECT * FROM customer; +SELECT title FROM film; +--- Retrieve the following columns from their respective tables: +SELECT name AS "language" FROM language; +SELECT first_name FROM staff; +SELECT distinct release_year FROM film; +SELECT COUNT(*) FROM store; +SELECT COUNT(*) staff_id FROM staff; +--- Films available to rent +SELECT COUNT(*) AS available_for_rent +FROM inventory; +--- Last names of Actors +SELECT COUNT(DISTINCT last_name) AS "Number_of_last_names" +FROM actor; +--- 10 longest films +SELECT length +FROM film +ORDER BY length DESC +LIMIT 10; +--- Retrieve all actors with the first name "SCARLETT" +SELECT * +FROM actor +WHERE first_name = "SCARLETT"; +--- BONUS +SELECT * +FROM film +WHERE length > 100 + AND title LIKE "%ARMAGEDDON%"; + +