커뮤니티
포인트
쿠폰
내 강의실
국비 신청 내역
증명서
계정
로그아웃
학습 질문
개발 일지
나의 활동
답변 완료
1번 실습 문제 중 지역별 조건에 대한 질문입니다.
[왕초보] 엑셀보다 쉽고 빠른 SQL
4주차
북마크
곽*준
댓글
1
추천
0
조회수
7
조회수
7
답변 완료

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

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


실습 1번에 대한 문제 내용에서 '음식 타입별 지역별 ~ ' 라고 명시가 되어 있는데 지역별에 대한 조건은 없이 쿼리 구문 진행이 되는 건지 질문 남깁니다. 아래에는 제가 작성한 쿼리문입니다.(칼럼명은 제가 임의로 작성하였습니다.)


```

SELECT cuisine_type,

  sido,

  sum_quantity,

  total_count_resturant, 

  CASE when total_count_resturant>=5 and sum_quantity>=30 then 0.005

   WHEN total_count_resturant>=5 and sum_quantity<30 then 0.008

   WHEN total_count_resturant<5 and sum_quantity>=30 then 0.01

   WHEN total_count_resturant<5 and sum_quantity<30 then 0.02

   END "수수료"

FROM (

SELECT cuisine_type , SUBSTR(addr, 1, 2) sido, sum(quantity) sum_quantity, COUNT(DISTINCT restaurant_name) total_count_resturant 

FROM food_orders fo 

group by 1, 2

) a

```


스파르타 즉문즉답


스파르타 즉문즉답








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