Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lære Challenge: Sales Performance Label | CASE WHEN Basics and Categorization
Practice
Projects
Quizzes & Challenges
Quizzer
Challenges
/
Mastering CASE WHEN in SQL

bookChallenge: Sales Performance Label

Opgave

Swipe to start coding

Write a query that adds a performance column to the sales table output, labeling each row based on quantity and price:

  • If both quantity is greater than or equal to 50 and price is greater than or equal to 100, label as 'Top'.
  • If only one of these conditions is met, label as 'Average'.
  • Otherwise, label as 'Low'.

Steps:

  • Use a CASE WHEN expression in the SELECT clause to create the performance column.
  • Check if both quantity is greater than or equal to 50 and price is greater than or equal to 100.
  • Check if only one of those conditions is met.
  • Label all other rows as 'Low'.

Løsning

Var alt klart?

Hvordan kan vi forbedre det?

Tak for dine kommentarer!

Sektion 1. Kapitel 6
single

single

Spørg AI

expand

Spørg AI

ChatGPT

Spørg om hvad som helst eller prøv et af de foreslåede spørgsmål for at starte vores chat

close

bookChallenge: Sales Performance Label

Stryg for at vise menuen

Opgave

Swipe to start coding

Write a query that adds a performance column to the sales table output, labeling each row based on quantity and price:

  • If both quantity is greater than or equal to 50 and price is greater than or equal to 100, label as 'Top'.
  • If only one of these conditions is met, label as 'Average'.
  • Otherwise, label as 'Low'.

Steps:

  • Use a CASE WHEN expression in the SELECT clause to create the performance column.
  • Check if both quantity is greater than or equal to 50 and price is greater than or equal to 100.
  • Check if only one of those conditions is met.
  • Label all other rows as 'Low'.

Løsning

Switch to desktopSkift til skrivebord for at øve i den virkelige verdenFortsæt der, hvor du er, med en af nedenstående muligheder
Var alt klart?

Hvordan kan vi forbedre det?

Tak for dine kommentarer!

Sektion 1. Kapitel 6
single

single

some-alt