From 7ea495bf8d64c92c931bd48554cbb21f97f073c7 Mon Sep 17 00:00:00 2001 From: AdityaTharunJ Date: Wed, 3 Jun 2026 13:08:23 +0530 Subject: [PATCH] Implement price classification using CASE statement Added a case statement to categorize product prices. --- SQL Deep Dive/Conditional Statements/questions.sql | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/SQL Deep Dive/Conditional Statements/questions.sql b/SQL Deep Dive/Conditional Statements/questions.sql index 13761af..7fe98bd 100644 --- a/SQL Deep Dive/Conditional Statements/questions.sql +++ b/SQL Deep Dive/Conditional Statements/questions.sql @@ -5,3 +5,10 @@ * if it's between 10 and 20 you show 'average' * and of is lower than or equal to 10 you show 'cheap'. */ +SELECT prod_id, title, price +CASE + WHEN price > 20 THEN "expensive" + WHEN price BETWEEN 10 AND 20 THEN "average" + WHEN price <= 10 THEN "cheap" +END AS "price class" +FROM products