1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
-- 1
select title from movies where year = 2008;
-- 2
select birth from people where name = 'Emma Stone';
-- 3
select title from movies where year >= 2018 order by title;
-- 4
select count(movie_id) from ratings where rating = 10.0;
-- 5
select title, year from movies where title like 'Harry Potter%' order by year;
-- 6
select sum(rating)/count(movie_id) from ratings join movies on ratings.movie_id = movies.id where movies.year = 2012;
-- 7
select movies.title, ratings.rating from ratings join movies on ratings.movie_id = movies.id where movies.year = 2010 order by ratings.rating desc, movies.title;
-- 8
select people.name from stars join movies on stars.movie_id = movies.id join people on stars.person_id = people.id where movies.title = 'Toy Story';
-- 9
select people.name from movies join stars on movies.id = stars.movie_id join people on stars.person_id = people.id where movies.year = 2004 order by people.birth;
-- 10
select distinct(people.name) from movies join ratings on movies.id = ratings.movie_id join directors on movies.id = directors.movie_id join people on directors.person_id = people.id where ratings.rating >= 9.0;
-- 11
select movies.title from movies join ratings on movies.id = ratings.movie_id join stars on movies.id = stars.movie_id join people on stars.person_id = people.id where people.name = 'Chadwick Boseman' order by ratings.rating desc limit 5;
-- 12
select movies.title from movies join stars on movies.id = stars.movie_id join people on stars.person_id = people.id where movies.id in (select stars.movie_id from stars join people on stars.person_id = people.id where people.name = 'Johnny Depp') and people.name = 'Helena Bonham Carter';
-- 13
select people.name from movies join stars on movies.id = stars.movie_id join people on stars.person_id = people.id where movies.title in (select movies.title from movies join stars on movies.id = stars.movie_id join people on stars.person_id = people.id where people.name = 'Kevin Bacon' and people.birth = 1958) and people.name != 'Kevin Bacon';
|