Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Learn Challenge: Custom Movie Ranking | Section
Practice
Projects
Quizzes & Challenges
Quizzes
Challenges
/
Mastering CASE WHEN in SQL
SectionΒ 1. ChapterΒ 17
single

single

bookChallenge: Custom Movie Ranking

Swipe to show menu

Task

Swipe to start coding

Write a query that ranks movies using a custom rule. 'Action' movies with a box_office greater than or equal to 50000000 should come first. All other movies should follow, ordered by rating in descending order.

  • Select all columns from the movies table.
  • Use CASE WHEN in the ORDER BY clause to ensure 'Action' movies with box_office >= 50000000 appear first.
  • For movies not meeting the above condition, order them by rating in descending order.

Solution

Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Everything was clear?

How can we improve it?

Thanks for your feedback!

SectionΒ 1. ChapterΒ 17
single

single

Ask AI

expand

Ask AI

ChatGPT

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

some-alt