ID | Title | Difficulty | |
---|---|---|---|
Loading... |
182. Duplicate Emails
Easy
LeetCode
Database
Problem
Write a SQL query to find all duplicate emails in a table named Person.
+----+---------+
| Id | Email |
+----+---------+
| 1 | [email protected] |
| 2 | [email protected] |
| 3 | [email protected] |
+----+---------+
For example, your query should return the following for the above table:
+---------+
| Email |
+---------+
| [email protected] |
+---------+
Code
# Write your MySQL query statement below
SELECT Email
FROM (
SELECT COUNT(*) AS num, Email
FROM Person
GROUP BY Email
) AS temp
WHERE temp.num >= 2
按 <- 键看上一题!
181. Employees Earning More Than Their Managers
按 -> 键看下一题!
183. Customers Who Never Order