duplicate-emails.sql (370B)
1 --This joins the table with itself where the id of a person is not the same but the email is. 2 --By doing this you get every time that an email is reused. Then using the distinct keyword it 3 --does not show duplicates of every email 4 --Time: 757ms Beats: 40.17% 5 SELECT DISTINCT p1.Email 6 FROM Person AS p1 7 INNER JOIN Person AS p2 8 ON p1.Email = p2.Email 9 WHERE p1.id != p2.id