Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Learn Challenge: Advanced Business Logic | CASE WHEN for Business Logic
Practice
Projects
Quizzes & Challenges
Quizzes
Challenges
/
SQL for Business Intelligence Analysts

bookChallenge: Advanced Business Logic

Task

Swipe to start coding

Classify each order using both region and total_amount by writing a SQL query with nested and multiple CASE WHEN statements. Follow these rules:

  • If the region is "Europe" and the total_amount is greater than 100, assign the label 'Priority';
  • Otherwise, if the total_amount is greater than 200, assign the label 'High Value';
  • All other orders should be labeled as 'Regular'.

Use a nested CASE WHEN structure to demonstrate your understanding. Return the columns: order_id, region_name, and the label as order_label.

Solution

Everything was clear?

How can we improve it?

Thanks for your feedback!

SectionΒ 2. ChapterΒ 4
single

single

Ask AI

expand

Ask AI

ChatGPT

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

Suggested prompts:

Can you explain this in simpler terms?

What are the main takeaways from this?

Can you provide an example to illustrate this?

close

bookChallenge: Advanced Business Logic

Swipe to show menu

Task

Swipe to start coding

Classify each order using both region and total_amount by writing a SQL query with nested and multiple CASE WHEN statements. Follow these rules:

  • If the region is "Europe" and the total_amount is greater than 100, assign the label 'Priority';
  • Otherwise, if the total_amount is greater than 200, assign the label 'High Value';
  • All other orders should be labeled as 'Regular'.

Use a nested CASE WHEN structure to demonstrate your understanding. Return the columns: order_id, region_name, and the label as order_label.

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Β 2. ChapterΒ 4
single

single

some-alt