commit 8aa2698610d66e32b57af63c4aa8156f5ec2eb3d Author: bot50 Date: Thu Mar 28 12:19:08 2024 +0000 kukemuna-cs50/problems/2024/x/movies@20240328T121908.736291326Z diff --git a/1.sql b/1.sql new file mode 100644 index 0000000..27c5e68 --- /dev/null +++ b/1.sql @@ -0,0 +1,3 @@ +SELECT title +FROM movies +WHERE year=2008; diff --git a/10.sql b/10.sql new file mode 100644 index 0000000..8dae9eb --- /dev/null +++ b/10.sql @@ -0,0 +1,8 @@ +SELECT DISTINCT name +FROM people +JOIN directors ON people.id = directors.person_id +WHERE movie_id IN ( + SELECT movie_id + FROM ratings + WHERE rating >= 9.0 +); diff --git a/11.sql b/11.sql new file mode 100644 index 0000000..7e8da86 --- /dev/null +++ b/11.sql @@ -0,0 +1,16 @@ +SELECT title +FROM movies +WHERE id IN ( + SELECT movie_id + FROM ratings + WHERE movie_id IN ( + SELECT movie_id + FROM stars + WHERE person_id IN ( + SELECT id + FROM people + WHERE name LIKE "Chadwick Boseman" + ) + ) + ORDER BY rating DESC LIMIT 5 + ); diff --git a/12.sql b/12.sql new file mode 100644 index 0000000..24bc945 --- /dev/null +++ b/12.sql @@ -0,0 +1,20 @@ +SELECT title +FROM movies +WHERE id IN ( + SELECT movie_id + FROM stars + WHERE person_id IN ( + SELECT id + FROM people + WHERE name LIKE "Bradley Cooper" + ) + ) +AND id IN ( + SELECT movie_id + FROM stars + WHERE person_id IN ( + SELECT id + FROM people + WHERE name LIKE "Bradley Cooper" + ) +); diff --git a/13.sql b/13.sql new file mode 100644 index 0000000..82453c4 --- /dev/null +++ b/13.sql @@ -0,0 +1,10 @@ +SELECT DISTINCT(name) +FROM people +WHERE name IS NOT "Kevin Bacon" AND id IN( + SELECT person_id FROM stars WHERE movie_id IN( + SELECT movie_id FROM stars WHERE person_id IN( + SELECT id FROM people WHERE name IS "Kevin Bacon" and birth = 1958 + ) + ) +) +; diff --git a/2.sql b/2.sql new file mode 100644 index 0000000..e92a5e6 --- /dev/null +++ b/2.sql @@ -0,0 +1,3 @@ +SELECT birth +FROM people +WHERE name='Emma Stone'; diff --git a/3.sql b/3.sql new file mode 100644 index 0000000..1caff93 --- /dev/null +++ b/3.sql @@ -0,0 +1,4 @@ +SELECT title +FROM movies +WHERE year>=2018 +ORDER BY title; diff --git a/4.sql b/4.sql new file mode 100644 index 0000000..e5dfb7b --- /dev/null +++ b/4.sql @@ -0,0 +1,3 @@ +SELECT COUNT(rating) +FROM ratings +WHERE rating=10; diff --git a/5.sql b/5.sql new file mode 100644 index 0000000..8252e5c --- /dev/null +++ b/5.sql @@ -0,0 +1,4 @@ +SELECT title, year +FROM movies +WHERE title LIKE 'Harry Potter%' +ORDER BY year; diff --git a/6.sql b/6.sql new file mode 100644 index 0000000..f43a0e3 --- /dev/null +++ b/6.sql @@ -0,0 +1,3 @@ +SELECT AVG(rating) +FROM ratings +JOIN movies ON ratings.movie_id = movies.id; diff --git a/7.sql b/7.sql new file mode 100644 index 0000000..9089bb1 --- /dev/null +++ b/7.sql @@ -0,0 +1,5 @@ +SELECT year, title, rating +FROM movies +JOIN ratings ON movies.id = ratings.movie_id +WHERE year = 2010 +ORDER BY rating DESC, title; diff --git a/8.sql b/8.sql new file mode 100644 index 0000000..351d4c0 --- /dev/null +++ b/8.sql @@ -0,0 +1,8 @@ +SELECT name +FROM people +JOIN stars ON people.id = stars.person_id +WHERE movie_id IN ( + SELECT id + FROM movies + WHERE title = 'Toy Story' +); diff --git a/9.sql b/9.sql new file mode 100644 index 0000000..a2c59d4 --- /dev/null +++ b/9.sql @@ -0,0 +1,9 @@ +SELECT DISTINCT(name) +FROM people +JOIN stars ON people.id = stars.person_id +WHERE movie_id IN ( + SELECT id + FROM movies + WHERE year = 2004 +) +ORDER BY birth;