← Quiz: SQL Interview Queries: all 10 questions
Quiz: SQL Interview Queries · Question 1 of 10
Which query finds duplicate emails in a users table?
Which query finds duplicate emails in a users table?
- A.SELECT email FROM users GROUP BY email HAVING COUNT(*) > 1
- B.SELECT DISTINCT email FROM users
- C.SELECT email FROM users WHERE COUNT(*) > 1
- D.SELECT email, COUNT(*) FROM users
Answer & explanation
Correct answer: SELECT email FROM users GROUP BY email HAVING COUNT(*) > 1
Group by the value and keep groups with more than one row. Aggregates can't go in WHERE.
Can you get the rest right without peeking?
Take the timed Quiz: SQL Interview Queries quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →