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 all the movies?
assistant
SELECT title FROM Movie;
human
What are their average ratings?
assistant
SELECT T2.title , AVG ( T1.stars ) FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID GROUP BY T1.mID;
human
Give me the movies with the highest average rating.
assistant
SELECT T2.title , AVG ( T1.stars ) FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID GROUP BY T1.mID ORDER BY AVG ( T1.stars ) DESC LIMIT 1 ;