Smart queries: find duplicate rows

On every project I’ve worked for the past few years, there came a question to find all duplicate rows in a table. And every time I mix up some of the code. So now it’s time to post the right code on my blog, so I can always find it back :-)


SELECT employee,
COUNT(employee) AS Occurrences
FROM emp
GROUP BY employee
HAVING ( COUNT(employee) > 1 )