Physical Address
304 North Cardinal St.
Dorchester Center, MA 02124
Table: Person
+-------------+---------+
| Column Name | Type |
+-------------+---------+
| id | int |
| email | varchar |
+-------------+---------+
id is the primary key column for this table.
Each row of this table contains an email. The emails will not contain uppercase letters.
Write an SQL query to report all the duplicate emails.
Return the result table in any order.
The query result format is in the following example.
Example 1:
Input:
Person table:
+----+---------+
| id | email |
+----+---------+
| 1 | a@b.com |
| 2 | c@d.com |
| 3 | a@b.com |
+----+---------+
Output:
+---------+
| Email |
+---------+
| a@b.com |
+---------+
Explanation: a@b.com is repeated two times.
SELECT Email from Person
Group By Email
Having Count(*) > 1;
with cte as
(SELECT email, count(id) cnt
from Person
group by email)
select email from cte
where cnt > 1
SELECT email AS Email
FROM Person
GROUP BY email
HAVING COUNT(email) > 1
In our experience, we suggest you solve this Duplicate Emails LeetCode Solution and gain some new skills from Professionals completely free and we assure you will be worth it.
If you are stuck anywhere between any coding problem, just visit Queslers to get the Duplicate Emails LeetCode Solution
I hope this Duplicate Emails LeetCode Solution would be useful for you to learn something new from this problem. If it helped you then don’t forget to bookmark our site for more Coding Solutions.
This Problem is intended for audiences of all experiences who are interested in learning about Data Science in a business context; there are no prerequisites.
Keep Learning!
More Coding Solutions >>