Untitled
unknown
plain_text
2 years ago
550 B
4
Indexable
WITH top AS (SELECT title,
rental_rate,
length,
rating
FROM movie
WHERE rental_rate > 2
ORDER BY length DESC
LIMIT 40)
SELECT top.rating,
MIN(top.length) AS min_length,
MAX(top.length) AS max_length,
AVG(top.length) AS avg_length,
MIN(top.rental_rate) AS min_rental_rate,
MAX(top.rental_rate) AS max_rental_rate,
AVG(top.rental_rate) AS avg_rental_rate
FROM top
GROUP BY top.rating
ORDER BY avg_length;Editor is loading...
Leave a Comment