Bird
0
0

Given this dbt model SQL snippet, what will be the output columns?

medium📝 Predict Output Q4 of 15
dbt - Governance and Collaboration
Given this dbt model SQL snippet, what will be the output columns?
SELECT customer_id, SUM(amount) AS total_amount FROM {{ ref('orders') }} GROUP BY customer_id
Acustomer_id only
Bcustomer_id, total_amount
Ccustomer_id, sum_amount
Dcustomer_id, amount
Step-by-Step Solution
Solution:
  1. Step 1: Analyze SQL aggregation

    The query sums 'amount' grouped by 'customer_id' and aliases it as 'total_amount'.
  2. Step 2: Identify output columns

    Output columns are 'customer_id' and 'total_amount' as per SELECT clause.
  3. Final Answer:

    customer_id, total_amount -> Option B
  4. Quick Check:

    Output columns = customer_id, total_amount [OK]
Quick Trick: Alias aggregated columns explicitly for clarity [OK]
Common Mistakes:
MISTAKES
  • Confusing alias name
  • Expecting original column without aggregation
  • Missing grouped columns

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More dbt Quizzes