Prepare > SQL > Advanced Select > Occupations
2023. 5. 16. 20:21ㆍHackerRank-My SQL
#문제
Pivot the Occupation column in OCCUPATIONS so that each Name is sorted alphabetically and displayed underneath its corresponding Occupation. The output column headers should be Doctor, Professor, Singer, and Actor, respectively.
=> 의사, 교수, 가수, 배우 로 열 이름을 정하고, 열 이름 밑에 알파벳순 이름을 보이게 OCCUPATIONS를 피벗하라.
SELECT Occupation FROM OCCUPATIONS
GROUP BY Occupation;
Professor
Actor
Doctor
Singer
한계를 느끼고
서브쿼리 - 피벗테이블 만들기(행/렬 전환)을 먼저 공부하기로 함
'HackerRank-My SQL' 카테고리의 다른 글
Prepare > SQL > Aggregation > Population Density Difference (0) | 2023.05.16 |
---|---|
Prepare > SQL > Aggregation > Japan Population (0) | 2023.05.16 |
Prepare > SQL > Aggregation > Average Population (0) | 2023.05.16 |
Prepare > SQL > Advanced Select > The PADS (0) | 2023.05.16 |
Prepare > SQL > Basic Select > Higher Than 75 Marks (0) | 2023.05.15 |