During initial data exploration, you load a 50,000-row CSV of customer records into a staging table named customers_stg. Each customer is supposed to be unique by the email column. You need a quick query that lists only the email addresses that appear more than once and shows how many times each one occurs so you can estimate the scope of duplication before cleansing. Which SQL statement meets this requirement?
SELECT DISTINCT email FROM customers_stg;
SELECT * FROM customers_stg WHERE email IS NULL;
SELECT email, COUNT() AS dup_count FROM customers_stg GROUP BY email HAVING COUNT() > 1;
SELECT email, COUNT(*) FROM customers_stg GROUP BY email;
The fastest exploratory way to surface duplicate values in a single column is to group the rows by that column and then keep only those groups whose size is greater than one. The correct SQL query accomplishes this using GROUP BY email to form the groups and HAVING COUNT(*) > 1 to filter out any group that occurs only once. This approach returns exactly the duplicated email addresses and their occurrence counts.
Selecting DISTINCT shows every unique address once, so duplicates are hidden rather than identified.
Filtering for email IS NULL only finds missing values, not duplicates.
Grouping without a HAVING filter lists every email's count, including those that are not duplicated, so it fails to isolate the duplicates as required.
Ask Bash
Bash is our AI bot, trained to help you pass your exam. AI Generated Content may display inaccurate information, always double-check anything important.
What does the HAVING clause do in SQL?
Open an interactive chat with Bash
Why is GROUP BY necessary when identifying duplicates?
Open an interactive chat with Bash
What’s the difference between DISTINCT and GROUP BY in SQL?
Open an interactive chat with Bash
CompTIA Data+ DA0-002 (V2)
Data Acquisition and Preparation
Your Score:
Report Issue
Bash, the Crucial Exams Chat Bot
AI Bot
Loading...
Loading...
Loading...
Pass with Confidence.
IT & Cybersecurity Package
You have hit the limits of our free tier, become a Premium Member today for unlimited access.
Military, Healthcare worker, Gov. employee or Teacher? See if you qualify for a Community Discount.
Monthly
$19.99 $11.99
$11.99/mo
Billed monthly, Cancel any time.
$19.99 after promotion ends
3 Month Pass
$44.99 $26.99
$8.99/mo
One time purchase of $26.99, Does not auto-renew.
$44.99 after promotion ends
Save $18!
MOST POPULAR
Annual Pass
$119.99 $71.99
$5.99/mo
One time purchase of $71.99, Does not auto-renew.
$119.99 after promotion ends
Save $48!
BEST DEAL
Lifetime Pass
$189.99 $113.99
One time purchase, Good for life.
Save $76!
What You Get
All IT & Cybersecurity Package plans include the following perks and exams .