Bird
0
0

Identify the error in this SQL snippet using CASE:

medium📝 Debug Q14 of 15
SQL - CASE Expressions
Identify the error in this SQL snippet using CASE:
SELECT Name, CASE Salary > 5000 THEN 'High' ELSE 'Low' END AS SalaryLevel FROM Employees;
AMissing WHEN keyword after CASE
BMissing END keyword at the end
CIncorrect alias usage for SalaryLevel
DCASE cannot be used in SELECT clause
Step-by-Step Solution
Solution:
  1. Step 1: Review CASE syntax

    CASE must be followed by WHEN condition THEN result; here WHEN is missing.
  2. Step 2: Check other parts

    END keyword is present; alias usage is correct; CASE is valid in SELECT.
  3. Final Answer:

    Missing WHEN keyword after CASE -> Option A
  4. Quick Check:

    CASE requires WHEN after CASE [OK]
Quick Trick: CASE always needs WHEN after it [OK]
Common Mistakes:
  • Omitting WHEN keyword
  • Confusing END with alias
  • Thinking CASE can't be in SELECT

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More SQL Quizzes