Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lære Challenge: Categorize Sales Volume | CASE WHEN Basics and Categorization
Mastering CASE WHEN in SQL

bookChallenge: Categorize Sales Volume

Opgave

Swipe to start coding

Write a query that selects all columns from the sales table and adds a new column named volume_category. The value of volume_category should be determined by the following rules:

  • If quantity is greater than or equal to 100, set volume_category to 'Bulk'.
  • If quantity is greater than or equal to 20 but less than 100, set volume_category to 'Standard'.
  • If quantity is less than 20, set volume_category to 'Small'.

Løsning

Var alt klart?

Hvordan kan vi forbedre det?

Tak for dine kommentarer!

Sektion 1. Kapitel 2
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: Categorize Sales Volume

Stryg for at vise menuen

Opgave

Swipe to start coding

Write a query that selects all columns from the sales table and adds a new column named volume_category. The value of volume_category should be determined by the following rules:

  • If quantity is greater than or equal to 100, set volume_category to 'Bulk'.
  • If quantity is greater than or equal to 20 but less than 100, set volume_category to 'Standard'.
  • If quantity is less than 20, set volume_category to 'Small'.

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 2
single

single

some-alt