
* 겪고 있는 문제 상황을 최대한 자세하게 작성해주세요.
* 문제 해결을 위해 어떤 시도를 해보았는지 구체적으로 함께 알려주세요.
안녕하세요, 4-4 강의를 듣다가 실습 문제를 잘못 이해를 한건지 의문이 들어서 질문을 남깁니다.
음식 타입별 지역별 총 주문수량과 음식점 수를 연산하는 서브쿼리에서, 강의는 음식 타입별로만 그룹화해서 서브쿼리를 만들었습니다.
제가 문제 이해를 잘 못한건가요?

SELECT cuisine_type,
sido,
count_res,
total_quantity,
CASE when count_res >= 5 and total_quantity >= 30 then 0.005
WHEN count_res >= 5 and total_quantity < 30 then 0.008
WHEN count_res < 5 and total_quantity >= 30 then 0.01
when count_res < 5 and total_quantity < 30 then 0.02
end ratio
FROM
(
SELECT cuisine_type ,
SUBSTR(addr, 1, 2) sido,
SUM(quantity) total_quantity,
COUNT(distinct restaurant_name) count_res
FROM food_orders fo
group by 1, 2
order by cuisine_type
) a
위 코드는 제가 작성한 코드입니다. 감사합니다.
