
* 겪고 있는 문제 상황을 최대한 자세하게 작성해주세요.
* 문제 해결을 위해 어떤 시도를 해보았는지 구체적으로 함께 알려주세요.
문제 중
SQL 실습 문제 중에 음식 단가, 음식 종류 별로 음식점 그룹 나누기 이런 문제가 있는데요
[실습] 음식 단가, 음식 종류 별로 음식점 그룹 나누기
제가 만든 답안은
Select cuisine_type,
price/quantity "단가",
restaurant_name,
order_id,
case when cuisine_type='Korean' then "한식"
when cuisine_type='Japanese' or cuisine_type='Chinese' or cuisine_type='Thai' or cuisine_type='Vietnamese' or cuisine_type='Indian'
then "아시아식"
else "기타" end "음식점 종류",
case when price/quantity<5000 then 'Low'
when price/quantity between 5000 and 15000 then 'Mid'
when price/quantity>15000 then 'High' end "음식 가격"
from food_orders
그리고 해설에 나온 답은
select restaurant_name,
price/quantity "단가",
cuisine_type,
order_id,
case when (price/quantity <5000) and cuisine_type='Korean' then '한식1'
when (price/quantity between 5000 and 15000) and cuisine_type='Korean' then '한식2'
when (price/quantity > 15000) and cuisine_type='Korean' then '한식3'
when (price/quantity <5000) and cuisine_type in ('Japanese', 'Chinese', 'Thai', 'Vietnamese', 'Indian') then '아시아식1'
when (price/quantity between 5000 and 15000) and cuisine_type in ('Japanese', 'Chinese', 'Thai', 'Vietnamese', 'Indian') then '아시아식2'
when (price/quantity > 15000) and cuisine_type in ('Japanese', 'Chinese', 'Thai', 'Vietnamese', 'Indian') then '아시아식3'
when (price/quantity <5000) and cuisine_type not in ('Korean', 'Japanese', 'Chinese', 'Thai', 'Vietnamese', 'Indian') then '기타1'
when (price/quantity between 5000 and 15000) and cuisine_type not in ('Korean', 'Japanese', 'Chinese', 'Thai', 'Vietnamese', 'Indian') then '기타2'
when (price/quantity > 15000) and cuisine_type not in ('Korean', 'Japanese', 'Chinese', 'Thai', 'Vietnamese', 'Indian') then '기타3' end "식당 그룹"
from food_orders
실제 코드 결과의 차이가 있는데 만약 시험이라면 오답으로 처리가 되는 것일까요?
