[SQL] Case-When을 이용한 피벗테이블
오늘은 Group by와 Aggregate, case-when을 결합하여 피벗테이블을 생성하는 법에 대해서 리뷰한다. 예시 테이블 소개 우리가 오늘 살펴볼 예제는 리트코드의 1179. Reformat Department Table이다.테이블 구조는 아래와 같다.테이블 명: Department+-------------+---------+| Column Name | Type |+-------------+---------+| id | int || revenue | int || month | varchar |+-------------+---------+In SQL,(id, month) is the primary key of this table.The tabl..