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 were produced in the year 2013 ?
assistant
SELECT COUNT ( DISTINCT title ) FROM movie WHERE release_year = 2013;
human
What are the series featuring ' Scott Foley ' ?
assistant
SELECT t2.title FROM CAST AS t3 JOIN actor AS t1 ON t3.aid = t1.aid JOIN tv_series AS t2 ON t2.sid = t3.msid WHERE t1.name = 'Scott Foley';
human
Who was the director of the movie Joy from 2015 ?
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.release_year = 2015 AND t3.title = 'Joy';
human
Which producer has worked with the most number of directors ?
assistant
SELECT t1.name FROM director AS t3 JOIN directed_by AS t2 ON t3.did = t2.did JOIN movie AS t4 ON t4.mid = t2.msid JOIN made_by AS t5 ON t4.mid = t5.msid JOIN producer AS t1 ON t1.pid = t5.pid GROUP BY t1.name ORDER BY COUNT ( DISTINCT t3.name ) DESC LIMIT 1;
human
Who is the director of 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';
human
Who is the director of the tv series ' House of Cards ' from 2013 ?
assistant
SELECT t2.name FROM director AS t2 JOIN directed_by AS t1 ON t2.did = t1.did JOIN tv_series AS t3 ON t3.sid = t1.msid WHERE t3.release_year = 2013 AND t3.title = "House of Cards" ;