Queries with GROUPING SETS
What question CANNOT be answered by the following query?
SELECT
r.customer_id,
m.genre,
AVG(r.rating),
COUNT(*)
FROM renting AS r
LEFT JOIN movies AS m
ON r.movie_id = m.movie_id
GROUP BY GROUPING SETS ((r.customer_id, m.genre), (r.customer_id), ());
This exercise is part of the course
Data-Driven Decision Making in SQL
Hands-on interactive exercise
Turn theory into action with one of our interactive exercises
