Most Popular Genres
Compito
Swipe to start coding
The manager of Ocean
cinema needs analytics: what genres are the most popular in his cinema? Rank it based on total sales for each genre.
Print genre
and sales
columns. sales
contains the total sales in Ocean
cinema for each genre. Reorder the records starting with the most popular genre.
Soluzione
9
1
2
3
4
5
6
7
8
select g.label as genre, sum(sales) as sales
from genre as g
inner join movie as m on m.genre_id=g.id
inner join schedule as s on s.movie_id=m.id
inner join cinema as c on c.id=s.cinema_id
where c.label='Ocean'
group by g.id
order by sales desc
Tutto è chiaro?
Grazie per i tuoi commenti!
Sezione 2. Capitolo 3
9
1
No query executed yet... |
Chieda ad AI
Chieda pure quello che desidera o provi una delle domande suggerite per iniziare la nostra conversazione