Bird
0
0

Identify the error in this dbt model snippet:

medium📝 Debug Q14 of 15
dbt - Jinja in dbt
Identify the error in this dbt model snippet:
SELECT
  user_id,
  CASE
    WHEN age > 18 THEN 'Adult'
    WHEN age <= 18 THEN 'Minor'
    ELSE 'Unknown'
FROM users
AMissing END keyword for CASE statement
BIncorrect comparison operator in WHEN clauses
CELSE clause cannot be used in CASE
DMissing comma after user_id
Step-by-Step Solution
Solution:
  1. Step 1: Check CASE statement syntax

    CASE statements must end with END keyword to close the block.
  2. Step 2: Verify presence of END keyword

    The snippet lacks END after ELSE 'Unknown', causing syntax error.
  3. Final Answer:

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

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

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More dbt Quizzes