182. Duplicate Emails

Description

Write a SQL query to find all duplicate emails in a table named Person.

For example, your query should return the following for the above table:

Constraints

Approach

  • GeeksforGeeks

  • ProgramCreek

  • YouTube

Examples

Input:

{"headers": {"Person": ["Id", "Email"]}, "rows": {"Person": [[1, "[email protected]"], [2, "[email protected]"], [3, "[email protected]"]]}}

Output:

{"headers": ["Email"], "values": [["[email protected]"]]}

Solutions

# MySQL query statement

SELECT Email 
FROM Person 
GROUP BY Email
HAVING COUNT(Email) > 1

Follow up

Last updated

Was this helpful?