Bird
0
0

What is wrong with this dbt model SQL snippet?

medium📝 Debug Q7 of 15
dbt - Jinja in dbt
What is wrong with this dbt model SQL snippet?
SELECT
  id,
  CASE WHEN score >= 90 THEN 'A'
       WHEN score >= 80 THEN 'B'
       WHEN score >= 70 THEN 'C'
       ELSE 'F'
FROM grades
AMissing END keyword for CASE statement
BIncorrect ELSE syntax
CWrong table name
DNo error
Step-by-Step Solution
Solution:
  1. Step 1: Check CASE statement completeness

    The CASE statement must end with END keyword, which is missing here.
  2. Step 2: Confirm other syntax parts

    ELSE syntax is correct, table name is valid, so missing END is the error.
  3. Final Answer:

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

    CASE must end with END keyword [OK]
Quick Trick: Always close CASE with END keyword [OK]
Common Mistakes:
MISTAKES
  • Forgetting END keyword
  • Misplacing ELSE
  • Assuming no error

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More dbt Quizzes