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 |
Tags
- Binary Tree
- Class
- array
- simulation
- string
- hash table
- bit manipulation
- database
- 코테
- Method
- implement
- two pointers
- java
- Matrix
- 구현
- SQL
- Math
- Counting
- sorting
- Binary Search
- geometry
- Stack
- greedy
- Tree
- Number Theory
- 파이썬
- 코딩테스트
- 자바
- dynamic programming
- Data Structure
Archives
- Today
- Total
코린이의 소소한 공부노트
[LeetCode/Easy] 2356. Number of Unique Subjects Taught by Each Teacher 본문
코딩테스트 풀이/SQL
[LeetCode/Easy] 2356. Number of Unique Subjects Taught by Each Teacher
무지맘 2023. 5. 2. 10:391. Input
1) Table: Teacher (pk: (subject_id, dept_id))
2. Output
1) 각 선생님 별로 가르치는 과목 수를 반환
- 출력 순서는 상관 없다.
- 과목 수를 셀 때 중복은 제외한다.
3. Example
4. Code
1) 첫 코드(2023/05/02)
select teacher_id, count(distinct subject_id) as cnt
from Teacher
group by teacher_id;
'코딩테스트 풀이 > SQL' 카테고리의 다른 글
[LeetCode/Easy] 619. Biggest Single Number (0) | 2023.05.25 |
---|---|
[LeetCode/Easy] 511. Game Play Analysis I (0) | 2023.05.23 |
[LeetCode/Easy] 1978. Employees Whose Manager Left the Company (0) | 2023.04.24 |
[LeetCode/Easy] 1890. The Latest Login in 2020 (0) | 2023.04.24 |
[LeetCode/Easy] 1873. Calculate Special Bonus (0) | 2023.04.22 |