From 46cb40eea81bc8a3f862ccdafd54bac93fcd3dd0 Mon Sep 17 00:00:00 2001 From: Paul Omogiate Obamwonyi Date: Thu, 27 Aug 2026 06:09:10 +0200 Subject: [PATCH 1/2] completed lab-sql-basic-queries.sql --- lab-sql-basic-queries.sql | 6 ++++++ 1 file changed, 6 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..be6ba43 --- /dev/null +++ b/lab-sql-basic-queries.sql @@ -0,0 +1,6 @@ +-- LAB | SQL Basic Queries + +USE sakila; + +-- Exercise 1: Display all available tables +SHOW TABLES; \ No newline at end of file From b2aa9e4d3475d3e182415ba8703860b6a0b425c3 Mon Sep 17 00:00:00 2001 From: Paul Omogiate Obamwonyi Date: Wed, 2 Sep 2026 18:50:37 +0200 Subject: [PATCH 2/2] modified lab-sql-basic-queries --- lab-sql-basic-queries.sql | 47 +++++++++++++++++++++++++++++++++++---- 1 file changed, 43 insertions(+), 4 deletions(-) diff --git a/lab-sql-basic-queries.sql b/lab-sql-basic-queries.sql index be6ba43..2718626 100644 --- a/lab-sql-basic-queries.sql +++ b/lab-sql-basic-queries.sql @@ -1,6 +1,45 @@ --- LAB | SQL Basic Queries - USE sakila; --- Exercise 1: Display all available tables -SHOW TABLES; \ No newline at end of file + +SHOW TABLES ; +SELECT * FROM actor; +SELECT * FROM film ; +SELECT * FROM customer; +SELECT name AS language FROM language ; +SELECT first_name FROM staff ; +SELECT DISTINCT release_year FROM film ; +SELECT COUNT(*) AS number_of_stores FROM store ; +SELECT COUNT(*) AS number_of_mployee FROM staff; +-- Exercise 5.3: Count films available for rent and films rented + +SELECT COUNT(*) AS films_available_for_rent +FROM inventory; + +SELECT COUNT(*) AS films_rented +FROM rental; +-- Exercise 5.4: Count distinct actor last names + +SELECT COUNT(DISTINCT last_name) AS number_of_distinct_last_names +FROM actor; +-- Exercise 6: Retrieve the 10 longest films + +SELECT title, length +FROM film +ORDER BY length DESC +LIMIT 10; +-- Exercise 7.1: Retrieve actors whose first name is SCARLETT + +SELECT * +FROM actor +WHERE first_name = 'SCARLETT'; +-- Exercise 7.2: Films containing ARMAGEDDON and longer than 100 minutes + +SELECT title, length +FROM film +WHERE title LIKE '%ARMAGEDDON%' + AND length > 100; + -- Exercise 7.3: Count films containing Behind the Scenes content + +SELECT COUNT(*) AS films_with_behind_the_scenes +FROM film +WHERE special_features LIKE '%Behind the Scenes%';