GROUP BY와 CTAS - 4
·
Database & Data/기초지식
Group by데이터의 특정 열(들)을 기준으로 그룹화하는 것을 의미예시 SQL문)SELECT product_idFROM salesGROUP BY product_id; Aggregate그룹화된 데이터에 대해 특정 연산을 수행하여 단일 값으로 요약하는 것을 의미예시 SQL문)SELECT product_id, SUM(quantity) as total_salesFROM salesGROUP BY product_id;SELECT product_id, COUNT(*) as sale_countFROM salesGROUP BY product_id;SELECT product_id, AVG(quantity) as average_salesFROM salesGROUP BY product_id; TO_CHAR 숫자나 날짜 데이..