Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Learn James Cameron Movies Sales | Ordering Data
Practice SQL with Cinema Database

book
James Cameron Movies Sales

Task

Swipe to start coding

James Cameron's movies are very popular, but are they such in each city? Create a list of cities, containing info about sales of James Cameron's movies.

Print records with two columns: city and sales (containing the total sales of James Cameron's movies). Order records by city in lexicographical order.

Solution

select distinct c.city as city, sum(sales) as sales
from schedule as s
inner join movie as m on m.id=s.movie_id
inner join director as d on d.id=m.director_id
inner join cinema as c on c.id=s.cinema_id
where d.full_name='James Cameron'
group by city
order by city

Everything was clear?

How can we improve it?

Thanks for your feedback!

Section 2. Chapter 2

Query ResultQuery Result
No query executed yet...

Ask AI

expand
ChatGPT

Ask anything or try one of the suggested questions to begin our chat

some-alt