728x90
728x90
프로그래머스 Level 2 성분으로 구분한 아이스크림 총 주문량 MySQL 문제 풀이 입니다.
링크 : https://school.programmers.co.kr/learn/courses/30/lessons/133026
✅ MySQL 답안 입니다 더보기 클릭!
더보기
-- 코드를 입력하세요
select icecream_info.ingredient_type, sum(first_half.total_order) as total_order
from first_half
join icecream_info on first_half.flavor = icecream_info.flavor
group by icecream_info.ingredient_type
📌 해설
-- 코드를 입력하세요
select icecream_info.ingredient_type, sum(first_half.total_order) as total_order
from first_half
join icecream_info on first_half.flavor = icecream_info.flavor
group by icecream_info.ingredient_type
group by 에서 적절히 icecream_info.ingredient_type 그룹화 하여 중복을 제거하고
묶은 row 들을 sum(first_half.total_order)하여 아이스크림의 가격 합산을 구해주는 아이디어가 풀이의 핵심이었습니다.
실행 결과
::
728x90
반응형
'✅ 문제풀이' 카테고리의 다른 글
프로그래머스 Level 2 숫자변환하기 JavaScript 문제 풀이 (0) | 2023.11.01 |
---|---|
프로그래머스 Level 3 여행경로 JavaScript 문제 풀이 (0) | 2023.10.22 |
프로그래머스 상품 별 오프라인 매출 구하기 MySQL (0) | 2023.10.15 |
프로그래머스 조건에 맞는 도서와 저자 리스트 출력하기 MySQL (0) | 2023.10.15 |
프로그래머스 Level 1 문자열 나누기 Javascript (0) | 2023.10.14 |