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

bookChallenge: Custom Movie Ranking

Tarea

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.

Solución

¿Todo estuvo claro?

¿Cómo podemos mejorarlo?

¡Gracias por tus comentarios!

Sección 3. Capítulo 5
single

single

Pregunte a AI

expand

Pregunte a AI

ChatGPT

Pregunte lo que quiera o pruebe una de las preguntas sugeridas para comenzar nuestra charla

close

bookChallenge: Custom Movie Ranking

Desliza para mostrar el menú

Tarea

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.

Solución

Switch to desktopCambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones
¿Todo estuvo claro?

¿Cómo podemos mejorarlo?

¡Gracias por tus comentarios!

Sección 3. Capítulo 5
single

single

some-alt