Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Impara Most Popular Genres | Ordering Data
Practice SQL with Cinema Database

book
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

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?

Come possiamo migliorarlo?

Grazie per i tuoi commenti!

Sezione 2. Capitolo 3

Query ResultQuery Result
No query executed yet...

Chieda ad AI

expand
ChatGPT

Chieda pure quello che desidera o provi una delle domande suggerite per iniziare la nostra conversazione

some-alt