Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Oppiskele Two Most Popular Movies | Join Data
Practice SQL with Cinema Database

book
Two Most Popular Movies

Tehtävä

Swipe to start coding

Find the most popular movie of the 20th century, and also the most popular movie of the 21st century (both based on total sales).

To submit the task, output two rows with columns named movie (for movie label), income (for total sales), and year.

Ratkaisu

(select m.label as movie, sum(sales) as income, yr as year
from movie as m
inner join schedule as s on s.movie_id=m.id
where yr<=2000
group by m.id
order by income desc
limit 1)
union
(select m.label as movie, sum(sales) as income, yr
from movie as m
inner join schedule as s on s.movie_id=m.id
where yr>2000
group by m.id
order by income desc
limit 1)

Oliko kaikki selvää?

Miten voimme parantaa sitä?

Kiitos palautteestasi!

Osio 3. Luku 7

Query ResultQuery Result
No query executed yet...

Kysy tekoälyä

expand
ChatGPT

Kysy mitä tahansa tai kokeile jotakin ehdotetuista kysymyksistä aloittaaksesi keskustelumme

some-alt