From 377b0c62b6cf4d81c550dad813c2933f90ec225a Mon Sep 17 00:00:00 2001 From: claracachapa Date: Sun, 24 Nov 2024 21:58:30 +0000 Subject: [PATCH] Solved lab --- lab-sql-subqueries-solved.sql | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 lab-sql-subqueries-solved.sql diff --git a/lab-sql-subqueries-solved.sql b/lab-sql-subqueries-solved.sql new file mode 100644 index 0000000..72c89b5 --- /dev/null +++ b/lab-sql-subqueries-solved.sql @@ -0,0 +1,19 @@ +USE sakila; + +SELECT COUNT(*) AS number_of_copies +FROM inventory i +JOIN film f ON i.film_id = f.film_id +WHERE f.title = 'Hunchback Impossible'; + +SELECT title, + length +FROM film +WHERE length > (SELECT AVG(length) FROM film); + +SELECT a.first_name, + a.last_name, + f.title +FROM actor a +JOIN film_actor fa ON a.actor_id = fa.actor_id +JOIN film f ON fa.film_id = f.film_id +WHERE f.title = 'Alone Trip'; \ No newline at end of file