Bird
0
0

Identify the error in this query using CASE in WHERE clause:

medium📝 Debug Q14 of 15
SQL - CASE Expressions
Identify the error in this query using CASE in WHERE clause:
SELECT * FROM Orders WHERE CASE order_status WHEN 'shipped' THEN TRUE ELSE FALSE;
AMissing END keyword for CASE expression
BIncorrect use of TRUE/FALSE in CASE
CCASE cannot be used in WHERE clause
DMissing THEN keyword in CASE
Step-by-Step Solution
Solution:
  1. Step 1: Check CASE syntax completeness

    The CASE expression must end with END keyword, which is missing here.
  2. Step 2: Verify other parts

    TRUE/FALSE usage is valid, CASE can be used in WHERE, and THEN keyword is present.
  3. Final Answer:

    Missing END keyword for CASE expression -> Option A
  4. Quick Check:

    CASE ... END required [OK]
Quick Trick: Always close CASE with END in WHERE [OK]
Common Mistakes:
  • Forgetting END keyword
  • Thinking CASE can't be in WHERE
  • Misplacing THEN keyword

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More SQL Quizzes