Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lab solved #323

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions lab solved.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
use sakila;

select count(film_id), name
from film
inner join film_category
using (film_id)
inner join category
using (category_id)
group by name;

select store_id, city, country
from store
inner join address
using(address_id)
inner join city
using(city_id)
inner join country
using(country_id);

select sum(amount), store_id
from store
inner join staff
using(store_id)
inner join payment
using(staff_id)
group by store_id;

select avg(length), name
from film
inner join film_category
using(film_id)
inner join category
using(category_id)
group by name
order by avg(length) desc;

select count(rental_date), title
from film
inner join inventory
using (film_id)
inner join rental
using(inventory_id)
group by title
order by count(rental_date) desc
limit 10;
limit 5;

select store_id, title
from film
inner join inventory
using(film_id)
where title="ACADEMY DINOSAUR" and store_id=1;

select title,