Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Apprendre Challenge: Blockbuster Filter | Conditional Filtering and Sorting with CASE WHEN
Practice
Projects
Quizzes & Challenges
Quiz
Challenges
/
Mastering CASE WHEN in SQL

bookChallenge: Blockbuster Filter

Tâche

Swipe to start coding

Write a query that selects all movies from the movies table and labels each as 'Blockbuster' if its box_office is greater than or equal to 100,000,000 or its rating is greater than or equal to 8.5, using a CASE WHEN expression for this logic. Only include movies that meet the blockbuster criteria in the result set.

  • Use a CASE WHEN expression in the WHERE clause to filter movies where box_office is greater than or equal to 100,000,000 or rating is greater than or equal to 8.5.
  • In the SELECT list, use a CASE WHEN expression to label each included movie as 'Blockbuster' or 'Standard' based on the same criteria.
  • Return the columns title, genre, rating, box_office, and the blockbuster label as blockbuster_status.

Solution

Tout était clair ?

Comment pouvons-nous l'améliorer ?

Merci pour vos commentaires !

Section 3. Chapitre 3
single

single

Demandez à l'IA

expand

Demandez à l'IA

ChatGPT

Posez n'importe quelle question ou essayez l'une des questions suggérées pour commencer notre discussion

close

bookChallenge: Blockbuster Filter

Glissez pour afficher le menu

Tâche

Swipe to start coding

Write a query that selects all movies from the movies table and labels each as 'Blockbuster' if its box_office is greater than or equal to 100,000,000 or its rating is greater than or equal to 8.5, using a CASE WHEN expression for this logic. Only include movies that meet the blockbuster criteria in the result set.

  • Use a CASE WHEN expression in the WHERE clause to filter movies where box_office is greater than or equal to 100,000,000 or rating is greater than or equal to 8.5.
  • In the SELECT list, use a CASE WHEN expression to label each included movie as 'Blockbuster' or 'Standard' based on the same criteria.
  • Return the columns title, genre, rating, box_office, and the blockbuster label as blockbuster_status.

Solution

Switch to desktopPassez à un bureau pour une pratique réelleContinuez d'où vous êtes en utilisant l'une des options ci-dessous
Tout était clair ?

Comment pouvons-nous l'améliorer ?

Merci pour vos commentaires !

Section 3. Chapitre 3
single

single

some-alt