Final answer:
To answer the student's question, an SQL query is provided that retrieves the number of movies and their Rating where the average movie length for each rating exceeds 120 minutes. The query uses the GROUP BY clause to group records by Rating and the HAVING clause to filter groups based on average movie length.
Step-by-step explanation:
The question involves writing an SQL query to find the number of movies and their corresponding Rating where the average Length of movies in each rating category exceeds 120 minutes. To achieve this, an SQL query that uses the GROUP BY and HAVING clauses can be constructed. The GROUP BY clause will group the records based on the Rating, and the HAVING clause will filter out the groups where the average Length is greater than 120 minutes.
Here is an example of how the SQL query could look:
SELECT COUNT(*), Rating
FROM Movies
GROUP BY Rating
HAVING AVG(Length) > 120;
This query selects two columns: the count of movies and their Rating. It groups the result set by the Rating and filters the groups by checking if their average Length is greater than 120 minutes using the HAVING clause.