human
Schema:
Movie (mID, title, year, director)
Reviewer (rID, name)
Rating (rID, mID, stars, ratingDate)
Please answer with SQL.
assistant
Sure, I understand.
human
How many directors are there?
assistant
SELECT COUNT( DISTINCT director ) FROM Movie;
human
How many of them only made one movie?
assistant
SELECT COUNT( * ) FROM ( SELECT director FROM Movie GROUP BY director HAVING COUNT( * ) = 1 );
human
What are the names of those directors?
assistant
SELECT director FROM Movie GROUP BY director HAVING COUNT( * ) = 1 ;