✅ 문제풀이
프로그래머스 성분으로 구분한 아이스크림 총 주문량 MySQL
dogfoot.dev
2023. 10. 15. 02:00
728x90
728x90
프로그래머스 Level 2 성분으로 구분한 아이스크림 총 주문량 MySQL 문제 풀이 입니다.
링크 : https://school.programmers.co.kr/learn/courses/30/lessons/133026
프로그래머스
코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.
programmers.co.kr
✅ 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
반응형