LeetCode - 182. Duplicate Emails (MySQL)

조민수·2024년 6월 2일
0

LeetCode

목록 보기
2/61

Easy, SQL - 중복값 찾기

RunTime : 874 ms


문제

Write a solution to report all the duplicate emails.
Note that it's guaranteed that the email field is not NULL.

Return the result table in any order.

The result format is in the following example.


풀이

  • 전체 데이터들 중 중복되는 데이터들을 찾을 땐 GROUP BY + HAVING으로 찾을 수 있다.
SELECT email FROM Person
GROUP BY email
HAVING COUNT(email) > 1
profile
사람을 좋아하는 Front-End 개발자

0개의 댓글