Bird
0
0

What will this dbt test return if the 'customers' table contains duplicate 'phone_number' entries?

medium📝 Predict Output Q5 of 15
dbt - Advanced Testing
What will this dbt test return if the 'customers' table contains duplicate 'phone_number' entries?
select phone_number, count(*) from {{ ref('customers') }} group by phone_number having count(*) > 1
AIt will list all phone numbers that appear more than once along with their counts
BIt will return an empty result because duplicates are ignored
CIt will throw a syntax error due to missing WHERE clause
DIt will return all phone numbers regardless of duplication
Step-by-Step Solution
Solution:
  1. Step 1: Analyze the SQL query

    The query groups by phone_number and filters groups with count > 1.
  2. Step 2: Understand output

    It returns phone numbers that have duplicates and their counts.
  3. Final Answer:

    It will list all phone numbers that appear more than once along with their counts -> Option A
  4. Quick Check:

    HAVING count(*) > 1 filters duplicates [OK]
Quick Trick: HAVING count(*) > 1 finds duplicates [OK]
Common Mistakes:
MISTAKES
  • Assuming duplicates are ignored automatically
  • Expecting syntax error without WHERE clause
  • Thinking it returns all rows

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More dbt Quizzes