-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmore-join.sql
40 lines (26 loc) · 871 Bytes
/
more-join.sql
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
27
28
29
30
31
32
33
34
35
36
37
38
-- 1.
-- List the films where the yr is 1962 [Show id, title]
SELECT id, title FROM movie
WHERE yr = '1962'
-- 2.
-- Give year of 'Citizen Kane'.
SELECT yr FROM movie
WHERE title = 'Citizen Kane'
-- 3.
-- List all of the Star Trek movies, include the id, title and yr (all of these movies include the words Star Trek in the title). Order results by year.
SELECT id, title, yr FROM movie
WHERE title LIKE '%Star Trek%'
ORDER BY yr
-- 4.
-- What id number does the actor 'Glenn Close' have?
SELECT id FROM actor WHERE name = 'Glenn Close'
-- 5.
-- What is the id of the film 'Casablanca'
SELECT id FROM movie WHERE title = 'Casablanca'
-- 6.
-- Obtain the cast list for 'Casablanca'.
-- what is a cast list?
-- Use movieid=11768, (or whatever value you got from the previous question)
SELECT name FROM actor
JOIN casting ON actorid = id
WHERE movieid = 11768