Bird
0
0

What will be the result of this dbt SQL query?

medium📝 Predict Output Q5 of 15
dbt - Advanced Patterns
What will be the result of this dbt SQL query?
SELECT json_array_length(data:items) AS item_count FROM orders

Assuming data:items is a JSON array.
ANumber of elements in the items array
BSum of all item values
CFirst element of the items array
DBoolean indicating if items exist
Step-by-Step Solution
Solution:
  1. Step 1: Understand json_array_length()

    This function returns the count of elements in a JSON array.
  2. Step 2: Analyze the query

    It counts how many elements are inside data:items for each order.
  3. Final Answer:

    Number of elements in the items array -> Option A
  4. Quick Check:

    json_array_length() returns array size [OK]
Quick Trick: json_array_length() counts JSON array elements [OK]
Common Mistakes:
MISTAKES
  • Thinking it sums values
  • Expecting first element
  • Confusing with boolean check

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More dbt Quizzes