커뮤니티
포인트
쿠폰
내 강의실
국비 신청 내역
증명서
계정
로그아웃
학습 질문
개발 일지
나의 활동
답변 완료
엑셀보다 쉽고 빠른 SQL
챕터 4
북마크
김*영
댓글
1
추천
0
조회수
7
조회수
7
답변 완료

왜 4-3 강의에서 다음과 같이 하면 강의와 동일한 결과가 나오지 않는지 궁금합니다. 제 생각으로는 평균단가 * 수수료를 했으므로 동일하게 나와야 할텐데, 강의에서 보여주는 수수료 값과 제 수수료 값은 다르게 나오는데 왜 그런지 궁금해요.

select restaurant_name,

avg_price,

case when avg_price < 5000 then avg_price*0.005

when avg_price between 5000 and 19999 then avg_price*0.01

when avg_price between 20000 and 29999 then avg_price*0.02

else avg_price*0.03 end "수수료"

from

(

select restaurant_name,

price/quantity as avg_price,

price

from food_orders

)a

group by 1

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