Bird
0
0

Given this dbt model snippet:

medium📝 Predict Output Q4 of 15
dbt - Jinja in dbt
Given this dbt model snippet:
SELECT
  user_id,
  CASE WHEN age >= 18 THEN 'adult' ELSE 'minor' END AS age_group
FROM users

What will be the value of age_group for a user with age 16?
A'minor'
B'adult'
CNULL
DError
Step-by-Step Solution
Solution:
  1. Step 1: Analyze the CASE condition for age 16

    The condition checks if age >= 18; 16 is less than 18, so condition is false.
  2. Step 2: Determine the ELSE result

    Since condition is false, the ELSE branch 'minor' is returned.
  3. Final Answer:

    'minor' -> Option A
  4. Quick Check:

    Age 16 < 18 -> age_group = 'minor' [OK]
Quick Trick: If condition false, ELSE value is returned [OK]
Common Mistakes:
MISTAKES
  • Assuming 16 is adult
  • Expecting NULL for false condition
  • Thinking it causes error

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More dbt Quizzes