취미가 좋다

182. Duplicate Emails 본문

SQL 문제풀이/Leetcode

182. Duplicate Emails

benlee73 2021. 9. 4. 11:06

https://leetcode.com/problems/duplicate-emails/

 

Duplicate Emails - LeetCode

Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview.

leetcode.com

Solution

SELECT Email
FROM Person
GROUP BY Email
HAVING COUNT(Email) > 1
  • Email이 같은 항목의 개수를 보고 중복되는 데이터를 반환한다.
  • GROUP BY ... HAVING 을 이용하여 중복되는 데이터를 묶는다.
  • COUNT 를 이용하여 중복되는 데이터를 센다.

'SQL 문제풀이 > Leetcode' 카테고리의 다른 글

180. Consecutive Numbers  (0) 2021.09.29
178. Rank Scores  (0) 2021.09.06
181. Employees Earning More Than Their Managers  (0) 2021.09.04
177. Nth Highest Salary  (0) 2021.08.13
176. Second Highest Salary  (0) 2021.08.13
Comments