SQL practice: CASE WHEN: If/Else Inside a Query
Chapter 8 · 8 questions · included in full access
Question 1 · easy
Solve it in your browserLabel employees 'Senior' if salary ≥ 80000, else 'Junior'.
Question 2 · easy
Solve it in your browserLabel orders 'Done' if status is Delivered, else 'Not Done'.
Question 3 · medium
Solve it in your browserLabel products 'Thick' if thickness is 4.0 or more, 'Thin' if less, and 'Not a sheet' if thickness is empty.
Question 4 · medium
Solve it in your browserGive each branch a label by region: North → 'Up North', South → 'Down South', everything else → 'Other'.
Question 5 · medium
Solve it in your browserFor each product, show a margin_health column: 'Good' if profit (price − cost) is above 700, 'OK' if above 400, else 'Thin'.
Question 6 · medium
Solve it in your browserFor each customer, show 'Old customer' if they signed up before 2019, 'Newer' otherwise, and 'Unknown' if the date is empty. (Order your WHENs carefully.)
Question 7 · hard
Solve it in your browserShow each employee with a band column: '80k+', '40k-80k', or 'under 40k'.
Question 8 · hard
Solve it in your browserLabel each product 'Premium' (3000 or more), 'Standard' (1000 or more) or 'Budget'. No product ever comes out Premium. Fix it.
These questions are part of full access.
The first chapters of every track are free. Full access is a one-time payment.
See pricing