0% found this document useful (0 votes)
21 views2 pages

Pabd Lista

nada tbvm
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views2 pages

Pabd Lista

nada tbvm
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

#PABD LISTA

#1
select count(*) as Qtd
from customer;

#2
select count(*) as Qtd
from film;

#3
#Maior duração
select title 'Titulo', length 'Duração'
from film
order by length desc limit 1;

#Menor duração
select title 'Titulo', length 'Duração'
from film
order by length asc limit 1;

#4
#Mais caro

select title 'Titulo', rental_rate 'Valor do aluguel'


from film
order by rental_rate desc limit 1;

#Mais barato

select title 'titulo', rental_rate 'Valor do aluguel'


from film
order by rental_rate asc limit 1;

#5
select f.title'Titulo', c.name'Categoria'
from film f
inner join film_category fc on f.film_id = fc.film_id
inner join category c on fc.category_id = c.category_id;

#6
select c.first_name'Nome', c.last_name'Sobrenome', ci.city'cidade',
co.country'País'
from customer
inner join address a on c.address_id = a.address.address_id
inner join city ci on a.city_id = ci.city_id
inner join country co on ci.country_id = co.country_id;

#7
select co.country'País', count(c.customer_id) as total_clientes
from customer
inner join address a on c.address_id = a.address_id
inner join city ci on a.city_id = ci.city_id
inner join country co on ci.country_id = co.country_id
group bt co.country
order by total clientes desc;

#8
select c.first_name 'Nome', c.last_name'Sobrenome', count(r.rental_id) as
total_alugueis
from customer c
inner join rental r on c.customer_id = r.customer_id
group by c.customer_id
order by total_alugueis desc limit 5;

#9
select c.name 'categoria', count(fc.fil_id) as total_filmes
from category c
inner join film_category fc on c.category_id = fc.category_id
group by c.name;

#10
select store_id 'id da loja ', sum(p.amount) as total_faturamento
from staff s
inner join payment p on s.staff_id = p.staff_id
group by s.store_id;

You might also like