Duplicate Emails LeetCode Solution

Problem – Duplicate Emails LeetCode Solution

SQL Schema

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  | [email protected] |
| 2  | [email protected] |
| 3  | [email protected] |
+----+---------+
Output: 
+---------+
| Email   |
+---------+
| [email protected] |
+---------+
Explanation: [email protected] is repeated two times.

Duplicate Emails LeetCode Solution in MySQL

SELECT Email from Person
Group By Email
Having Count(*) > 1;

Duplicate Emails LeetCode Solution in MS SQL Server

with cte as
(SELECT email, count(id) cnt
from Person
group by email)
select email from cte
where cnt > 1

Duplicate Emails LeetCode Solution in Oracle

SELECT email AS Email 
    FROM Person 
        GROUP BY email 
            HAVING COUNT(email) > 1 
Duplicate Emails LeetCode Solution Review:

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

Find on Leetcode

Conclusion:

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 >>

LeetCode Solutions

Hacker Rank Solutions

CodeChef Solutions

Leave a Reply

Your email address will not be published.