Finding duplicate records in a database: the SQL HAVING clause
One issue I run across occasionally is a table with duplicate entries such as two entries for the same company in an accounts payable system. This can create embarrassing problems with billing if ACME Inc #1 is 90 days overdue because someone credited a payment, and now a credit, to ACME Inc #2. I ran across this problem recently on a health records system which was missing a UNIQUE constraint on a secondary patient ID field: student ID. The