In this Leetcode Duplicate Emails problem solution we need to write a SQL query to find all duplicate emails in a table named Person.
Problem solution in Oracle.
SELECT email FROM person GROUP BY email HAVING COUNT(email) > 1 The > = 2 seems faster. I have no idea why, coudl be pure luck SELECT email FROM person GROUP BY email HAVING COUNT(email) >= 2
Problem solution in Mysql.
select Email from (select count(distinct Id) , Email from Person Group by Email Having count(distinct ID)>1) a;
Problem solution in C++.
Select Email FROM Person Group by Email Having count(Email) > 1
0 Comments