Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lära Challenge: Blockbuster Filter | Conditional Filtering and Sorting with CASE WHEN
Mastering CASE WHEN in SQL

bookChallenge: Blockbuster Filter

Uppgift

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.

Lösning

Var allt tydligt?

Hur kan vi förbättra det?

Tack för dina kommentarer!

Avsnitt 3. Kapitel 3
single

single

Fråga AI

expand

Fråga AI

ChatGPT

Fråga vad du vill eller prova någon av de föreslagna frågorna för att starta vårt samtal

close

bookChallenge: Blockbuster Filter

Svep för att visa menyn

Uppgift

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.

Lösning

Switch to desktopByt till skrivbordet för praktisk övningFortsätt där du är med ett av alternativen nedan
Var allt tydligt?

Hur kan vi förbättra det?

Tack för dina kommentarer!

Avsnitt 3. Kapitel 3
single

single

some-alt