Bird
0
0

Identify the error in this dbt model SQL snippet:

medium📝 Debug Q6 of 15
dbt - Governance and Collaboration
Identify the error in this dbt model SQL snippet:
SELECT product_id, SUM(quantity) AS total_quantity FROM orders WHERE order_date GROUP BY product_id
Aproduct_id should be aliased
BMissing condition after WHERE clause
CSUM() cannot be used with GROUP BY
DGROUP BY should come before WHERE
Step-by-Step Solution
Solution:
  1. Step 1: Check WHERE clause syntax

    WHERE clause requires a condition; here it is incomplete.
  2. Step 2: Validate SQL order

    GROUP BY correctly follows WHERE; SUM() is valid with GROUP BY.
  3. Final Answer:

    Missing condition after WHERE clause -> Option B
  4. Quick Check:

    WHERE needs condition [OK]
Quick Trick: Always provide a condition after WHERE [OK]
Common Mistakes:
MISTAKES
  • Placing GROUP BY before WHERE
  • Misunderstanding SUM with GROUP BY
  • Thinking alias is mandatory

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More dbt Quizzes