TASK 6 Multi-table queries with JOINs Flashcards
1
Q
Find the domestic and international sales for each movie
A
SELECT title, domestic_sales, international_sales
FROM movies
JOIN boxoffice
ON movies.id = boxoffice.movie_id;
2
Q
Show the sales numbers for each movie that did better internationally rather than domestically
A
SELECT title, domestic_sales, international_sales
FROM movies
JOIN boxoffice
ON movies.id = boxoffice.movie_id
WHERE international_sales > domestic_sales;
3
Q
List all the movies by their ratings in descending order
A
SELECT title, rating
FROM movies
JOIN boxoffice
ON movies.id = boxoffice.movie_id
ORDER BY rating DESC;