Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Найдите средние значения полей, в которых указаны минимальная и максимальная длительность отобранных фильмов. Отобразите только два этих поля. Назовите их avg_min_length и avg_max_length соответственно.
- SELECT AVG(min_length) AS avg_min_length,
- AVG(max_length) AS avg_max_length
- FROM
- (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
- (SELECT title,
- rental_rate,
- LENGTH,
- rating
- FROM movie
- WHERE rental_rate > 2
- ORDER BY LENGTH DESC
- LIMIT 40) AS top
- GROUP BY top.rating
- ORDER BY avg_length) AS sub;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement