The Movie table has the following columns:
Write a SELECT statement to select the year and the total number of movies for that year.
Hint: Use the COUNT() function and GROUP BY clause.
The query should be:
SELECT Year, COUNT(*) FROM Movie GROUP BY Year;
Explanation:
SELECT clause is used to mention the columns to be displayed on the screen.
That means, Year and the COUNT of that year should be printed on the screen.
FROM clause is used to mention the table name from which we are retrieving the data.
So, table name is Movie.
GROUP BY clause is used to tell that we have to group the rows according to the Year column, so that COUNT can be applied on it.
PLEASE UPVOTE IF YOU FOUND THIS HELPFUL!
Get Answers For Free
Most questions answered within 1 hours.