Bird
0
0

Given the dbt SQL snippet:

medium📝 Predict Output Q4 of 15
dbt - Advanced Patterns
Given the dbt SQL snippet:
SELECT data:customer->'address'->>'city' AS city FROM customers

What will be the output type of the city column?
AString/text
BJSON object
CInteger
DBoolean
Step-by-Step Solution
Solution:
  1. Step 1: Understand JSON operators

    -> extracts JSON object; ->> extracts text value from JSON key.
  2. Step 2: Analyze the expression

    data:customer->'address' extracts JSON object; ->>'city' extracts the city value as text/string.
  3. Final Answer:

    String/text -> Option A
  4. Quick Check:

    ->> operator returns text/string [OK]
Quick Trick: ->> returns text, -> returns JSON object [OK]
Common Mistakes:
MISTAKES
  • Confusing -> and ->> operators
  • Expecting JSON object instead of string
  • Assuming numeric or boolean type

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More dbt Quizzes