커뮤니티
포인트
쿠폰
내 강의실
국비 신청 내역
증명서
계정
로그아웃
학습 질문
개발 일지
나의 활동
답변 완료
4-04. [실습] 복잡한 연산을 Subquery 로 수행하기 실습1
엑셀보다 쉽고 빠른 SQL v0
4주차
북마크
고*리
댓글
4
추천
0
조회수
16
조회수
16
답변 완료

* 겪고 있는 문제 상황을 최대한 자세하게 작성해주세요.

* 문제 해결을 위해 어떤 시도를 해보았는지 구체적으로 함께 알려주세요.


강사님과 같은 코드를 쳤는데 왜 에러가 나는지 모르겠어요ㅠㅠ



스파르타 즉문즉답





select cuisine_type,

total_quantity,

count_res

case when count_res>=5 and total_quantity>=30 then 0.0005

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 rate

from

(

select cuisine_type,

sum(quantity) total_quantity,

count(distinct restaurant_name) count_res

from food_orders

group by 1

) a


취소
 공유
취소
댓글 0
댓글 알림
나의얼굴