Be honest — how many times have you Googled "SQL find duplicate rows" this year? Some queries just never stick in my head. Here are 5 I re-look-up constantly, with working answers you can copy. Syntax is PostgreSQL, with notes where other databases differ.

1. Find duplicate rows

SELECT email, COUNT(*) AS count

FROM users

GROUP BY email