diff --git a/lab3.sql b/lab3.sql new file mode 100644 index 0000000..2a90a27 --- /dev/null +++ b/lab3.sql @@ -0,0 +1,48 @@ +USE sakila; + +SELECT +MAX(length) as max_duration, +MIN(length) as min_duration, +round(avg(length),0) +FROM film; + + +select + +datediff(max(rental_date),min(rental_date)) + +from rental; + + +select +MONTHNAME(rental_date), +DAYNAME(rental_date) +from rental; + +select +title, + +ifnull(rental_duration,'not available') as rental_duration + + +from film; + + + +select +count(title), +rating + +from film +group by +rating +order by count(title)desc; + + +SELECT + rating, + ROUND(AVG(length), 2) AS mean_duration +FROM film +GROUP BY rating +HAVING AVG(length) > 120 +ORDER BY mean_duration DESC; \ No newline at end of file