Bird
0
0

What will be the result of this dbt model SQL?

medium📝 Predict Output Q5 of 15
dbt - Governance and Collaboration
What will be the result of this dbt model SQL?
SELECT user_id, COUNT(*) AS login_count FROM {{ ref('user_logins') }} WHERE login_date >= '2024-01-01' GROUP BY user_id
ACounts of logins per user since 2024-01-01
BTotal logins for all users combined
CList of user_ids without counts
DError due to missing GROUP BY clause
Step-by-Step Solution
Solution:
  1. Step 1: Understand filtering and grouping

    The query filters logins from 2024-01-01 and groups by user_id.
  2. Step 2: Interpret aggregation

    COUNT(*) counts logins per user after filtering.
  3. Final Answer:

    Counts of logins per user since 2024-01-01 -> Option A
  4. Quick Check:

    Aggregation with filter = per-user counts [OK]
Quick Trick: GROUP BY user_id counts logins per user [OK]
Common Mistakes:
MISTAKES
  • Thinking it sums all users together
  • Ignoring WHERE filter
  • Expecting error without GROUP BY

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More dbt Quizzes