213k views
1 vote
List the movie id, title, production id, and production name for all movies, sorted by the id of the movie, in decreasing order (largest first). Take a screenshot now and paste it here.

User Saraband
by
8.2k points

1 Answer

5 votes

Final answer:

To list movies by id in decreasing order, use the SQL query provided.

Step-by-step explanation:

To list the movie id, title, production id, and production name for all movies, sorted by the id of the movie in decreasing order, you can use the following SQL query:

SELECT movies.id AS movie_id, movies.title, productions.id AS production_id, productions.name AS production_name FROM movies JOIN productions ON movies.production_id = productions.id ORDER BY movies.id DESC;

This query uses the JOIN keyword to combine the movies and productions tables based on their common production_id column. The ORDER BY clause sorts the result in descending order of the movie id.

User Dreagan
by
7.9k points