250x250
Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 | 31 |
Tags
- 내일배움캠프
- map
- Leetcode
- DATE_SUB
- Max
- SQLD
- 데이터시각화
- 통계학
- python
- 반복문
- 프로그래머스
- 아티클스터디
- ★
- 내배캠_학습기록
- 리스트
- 데이터전처리
- AB테스트
- SQL
- 다중공선성
- 시각화
- 이중for문
- 선형회귀
- f-string
- 내일배움일지
- 한줄for문
- 가설검정
- Til
- Join
- Set
- 태블로
Archives
- Today
- Total
노력에는 지름길이 없으니까요
(★) LeetCode - 1789. Primary Department for Each Employee 본문
728x90
해결일 | 언어 | 레벨 | 테스트명 |
20240812 | SQL | easy | 1789. Primary Department for Each Employee |
링크 : https://leetcode.com/problems/primary-department-for-each-employee/
테스트 케이스에 말도 안되는 게 하나 껴있었는데... (22번!!!)
토론 에리어에서는 결국 잘못된 데이터에 대해서도 대처할 수 있는 코드를 짜는 것도 능력이다. <로 다들 귀결하고 있기에
내 실력이 아직 멀었구나 따위를 느끼는 중이다
다음에 다시 풀어봐야지...👊
베스트 코드
# Write your MySQL query statement below
(SELECT
employee_id,
department_id
FROM Employee
GROUP BY 1
HAVING COUNT(DISTINCT department_id) = 1
)
UNION ALL
(SELECT
employee_id
,department_id
FROM Employee
WHERE primary_flag = 'Y'
)
728x90
반응형
'SQL > LeetCode' 카테고리의 다른 글
LeetCode - 626. Exchange Seats (0) | 2024.08.16 |
---|---|
LeetCode - 1141. User Activity for the Past 30 Days I (0) | 2024.08.14 |
LeetCode - 178. Rank Scores (0) | 2024.08.12 |
LeetCode - 181. Employees Earning More Than Their Managers (0) | 2024.08.09 |
LeetCode - 182. Duplicate Emails (0) | 2024.08.09 |