LeetCode - 182. Duplicate Emails (MySQL)

조민수·2024년 6월 2일
0

LeetCode

목록 보기
2/75

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
멈춤에 두려움을 느끼는 것

0개의 댓글

관련 채용 정보