310. 상품 별 오프라인 매출 구하기

김해준's avatar
Jan 26, 2026
310. 상품 별 오프라인 매출 구하기

사용언어 : MySQL

문제

notion image
notion image

풀이

product 테이블 데이터 확인
notion image
offline_sale 테이블 데이터 확인
notion image
offline_sale 테이블을 product_id별로 묶고 sales_amount 개수 파악
notion image
product테이블에 필터링한 offline_sale테이블 조인하기(product_id가 같음으로 비교)
notion image
product_code와 price, sum값만 필터링
notion image
price와 sum을 곱하여 필터링
notion image
필터링 데이터의 이름을 결과값과 맞추고 매출액 순으로 내림차순, 상품코드 순으로 오름차순
notion image
notion image
Share article