Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lære Movies Rating | Aggregating Data
Practice SQL with Cinema Database

book
Movies Rating

Opgave

Swipe to start coding

For each cinema, let's create a rating of movies: order movies in each cinema by its rating. Display the cinema.label, movie.label, and rating as cinema, movie, and rating columns. Order records by cinema.id and rating (starting with the best).

Løsning

select c.label as cinema, m.label as movie, m.rating as rating
from cinema as c
left join schedule as s on s.cinema_id=c.id
left join movie as m on m.id=s.movie_id
order by c.id, rating desc

Var alt klart?

Hvordan kan vi forbedre det?

Tak for dine kommentarer!

Sektion 1. Kapitel 8

Query ResultQuery Result
No query executed yet...

Spørg AI

expand
ChatGPT

Spørg om hvad som helst eller prøv et af de foreslåede spørgsmål for at starte vores chat

some-alt