You have imported 500 000 rows of customer-survey responses into a PostgreSQL table named survey_responses. Each respondent should appear exactly once, identified by respondent_id. During initial data exploration you want to list only those respondent_id values that are duplicated and show how many times each duplicate occurs so you can decide how to resolve them. Which SQL query accomplishes this goal?
SELECT respondent_id FROM survey_responses GROUP BY respondent_id;
SELECT respondent_id FROM survey_responses WHERE respondent_id IS NULL;
SELECT respondent_id, COUNT() AS occurrences FROM survey_responses GROUP BY respondent_id HAVING COUNT() > 1;
SELECT DISTINCT respondent_id FROM survey_responses;
The GROUP BY clause groups rows that share the same respondent_id, and the HAVING COUNT(*) > 1 filter keeps only those groups whose count exceeds one-exactly the set of duplicated identifiers you need to investigate. The DISTINCT query lists every unique respondent_id (including those that appear only once), so it does not isolate duplicates. The IS NULL filter tests for missing values, not duplication. Grouping without a HAVING filter returns all respondent_id groups whether or not they are duplicated, leaving the analyst to sift through single-row groups manually.
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 GROUP BY clause do in SQL?
Open an interactive chat with Bash
What is the purpose of the HAVING clause in SQL?
Open an interactive chat with Bash
How does COUNT(*) work in SQL and why is it useful?
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 .