Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions SQL Deep Dive/Conditional Statements/questions.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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