human
Schema:
actor (aid, gender, name, nationality, birth_city, birth_year)
copyright (id, msid, cid)
cast (id, msid, aid, role)
genre (gid, genre)
classification (id, msid, gid)
company (id, name, country_code)
director (did, gender, name, nationality, birth_city, birth_year)
producer (pid, gender, name, nationality, birth_city, birth_year)
directed_by (id, msid, did)
keyword (id, keyword)
made_by (id, msid, pid)
movie (mid, title, release_year, title_aka, budget)
tags (id, msid, kid)
tv_series (sid, title, release_year, num_of_seasons, num_of_episodes, title_aka, budget)
writer (wid, gender, name, nationality, num_of_episodes, birth_city, birth_year)
written_by (id, msid, wid)
Please answer with SQL.
assistant
Sure, I understand.
human
How many movies did ' Quentin Tarantino ' direct before 2010 ?
assistant
SELECT COUNT ( DISTINCT t3.title ) FROM director AS t2 JOIN directed_by AS t1 ON t2.did = t1.did JOIN movie AS t3 ON t3.mid = t1.msid WHERE t2.name = 'Quentin Tarantino' AND t3.release_year < 2010;
human
Which movies did ' Alfred Hitchcock ' direct ?
assistant
SELECT t3.title FROM director AS t2 JOIN directed_by AS t1 ON t2.did = t1.did JOIN movie AS t3 ON t3.mid = t1.msid WHERE t2.name = 'Alfred Hitchcock';
human
What movies have the same director as the movie ' Revolutionary Road ' ?
assistant
SELECT t3.title FROM director AS t5 JOIN directed_by AS t2 ON t5.did = t2.did JOIN directed_by AS t1 ON t5.did = t1.did JOIN movie AS t4 ON t4.mid = t2.msid JOIN movie AS t3 ON t3.mid = t1.msid WHERE t4.title = 'Revolutionary Road';
human
How many movies did ' Steven Spielberg ' direct ?
assistant
SELECT COUNT ( DISTINCT t3.title ) FROM director AS t2 JOIN directed_by AS t1 ON t2.did = t1.did JOIN movie AS t3 ON t3.mid = t1.msid WHERE t2.name = 'Steven Spielberg';
human
Find all actors from Canada who acted in ' James Bond ' movies
assistant
SELECT t1.name FROM CAST AS t2 JOIN actor AS t1 ON t2.aid = t1.aid JOIN movie AS t3 ON t3.mid = t2.msid WHERE t1.nationality = 'Canada' AND t3.title = 'James Bond';
human
Who directed the movie ' James Bond ' ?
assistant
SELECT t2.name FROM director AS t2 JOIN directed_by AS t1 ON t2.did = t1.did JOIN movie AS t3 ON t3.mid = t1.msid WHERE t3.title = "James Bond" ;