From d7efb1e45a7849fcfd5651108908a45388022c4c Mon Sep 17 00:00:00 2001 From: Sibabalwe <102536140+Ngandana@users.noreply.github.com> Date: Mon, 25 Nov 2024 13:14:56 +0200 Subject: [PATCH] Update questions(my answers).sql --- SQL Deep Dive/Conditional Statements/questions.sql | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/SQL Deep Dive/Conditional Statements/questions.sql b/SQL Deep Dive/Conditional Statements/questions.sql index 13761af..51c01f0 100644 --- a/SQL Deep Dive/Conditional Statements/questions.sql +++ b/SQL Deep Dive/Conditional Statements/questions.sql @@ -5,3 +5,11 @@ * 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, + CASE + when price > 20 THEN 'expensive' + when price > 10 and price <= 20 then 'average' + WHEN price <= 10 then 'cheap' + end as price_class +FROM products +