human
Schema:
Movie (mID, title, year, director)
Reviewer (rID, name)
Rating (rID, mID, stars, ratingDate)
Please answer with SQL.
assistant
Sure, I understand.
human
What are the names of the directors who made exactly one movie?
assistant
SELECT director FROM Movie GROUP BY director HAVING count(*) = 1
human
How many movies were made before 2000?
assistant
SELECT count(*) FROM Movie WHERE YEAR < 2000
human
What are the titles and directors of the movies whose star is greater than the average stars of the movies directed by James Cameron?
assistant
SELECT T2.title , T2.director FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID WHERE T1.stars > (SELECT avg(T1.stars) FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID WHERE T2.director = 'James Cameron')
human
What is the names of movies whose created year is after all movies directed by Steven Spielberg?
assistant
SELECT title FROM Movie WHERE YEAR > (SELECT max(YEAR) FROM Movie WHERE director = 'Steven Spielberg')
human
What is the name of the movie produced after 2000 and directed by James Cameron?
assistant
SELECT title FROM Movie WHERE director = 'James Cameron' AND YEAR > 2000
human
What are names of the movies that are either made before 1980 or directed by James Cameron?
assistant
SELECT title FROM Movie WHERE director = "James Cameron" OR YEAR < 1980 ;