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

bookChallenge: Categorize Sales Volume

Task

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'.

Solution

Everything was clear?

How can we improve it?

Thanks for your feedback!

SectionΒ 1. ChapterΒ 2
single

single

Ask AI

expand

Ask AI

ChatGPT

Ask anything or try one of the suggested questions to begin our chat

close

bookChallenge: Categorize Sales Volume

Swipe to show menu

Task

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'.

Solution

Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Everything was clear?

How can we improve it?

Thanks for your feedback!

SectionΒ 1. ChapterΒ 2
single

single

some-alt