🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← 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?

  1. A.SELECT email FROM users GROUP BY email HAVING COUNT(*) > 1
  2. B.SELECT DISTINCT email FROM users
  3. C.SELECT email FROM users WHERE COUNT(*) > 1
  4. 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 →