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 2002 and after 2010 ?
assistant
SELECT COUNT ( DISTINCT t4.title ) 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 WHERE t3.name = 'Quentin Tarantino' AND t4.release_year < 2010 AND t4.release_year > 2002;
human
How many movies did ' Quentin Tarantino ' direct after 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
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
Find all movies produced in 2015
assistant
SELECT title FROM movie WHERE release_year = 2015;
human
How many movies were produced in the year 2013 ?
assistant
SELECT COUNT ( DISTINCT title ) FROM movie WHERE release_year = 2013;
human
How many movies about Iraq war were produced in 2015 ?
assistant
SELECT COUNT( DISTINCT t3.title ) FROM tags AS t2 JOIN keyword AS t1 ON t2.kid = t1.id JOIN movie AS t3 ON t2.msid = t3.mid WHERE t1.keyword = "Iraq war" AND t3.release_year = 2015 ;