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 is the name of the most recent movie?
assistant
SELECT title FROM Movie WHERE YEAR = (SELECT max(YEAR) FROM Movie)
human
What are the names of directors who directed movies with 5 star rating? Also return the title of these movies.
assistant
SELECT T1.director , T1.title FROM Movie AS T1 JOIN Rating AS T2 ON T1.mID = T2.mID WHERE T2.stars = 5
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 the names of the directors who made exactly one movie excluding director NULL?
assistant
SELECT director FROM Movie WHERE director != 'null' GROUP BY director HAVING count(*) = 1
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
Who directed Avatar?
assistant
SELECT director FROM Movie WHERE title = "Avatar" ;