Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lære Challenge: Custom Movie Ranking | Conditional Filtering and Sorting with CASE WHEN
Practice
Projects
Quizzes & Challenges
Quizer
Challenges
/
Mastering CASE WHEN in SQL

bookChallenge: Custom Movie Ranking

Oppgave

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.

Løsning

Alt var klart?

Hvordan kan vi forbedre det?

Takk for tilbakemeldingene dine!

Seksjon 3. Kapittel 5
single

single

Spør AI

expand

Spør AI

ChatGPT

Spør om hva du vil, eller prøv ett av de foreslåtte spørsmålene for å starte chatten vår

close

bookChallenge: Custom Movie Ranking

Sveip for å vise menyen

Oppgave

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.

Løsning

Switch to desktopBytt til skrivebordet for virkelighetspraksisFortsett der du er med et av alternativene nedenfor
Alt var klart?

Hvordan kan vi forbedre det?

Takk for tilbakemeldingene dine!

Seksjon 3. Kapittel 5
single

single

some-alt