PM 부트캠프

[PM 부트캠프 - 10일차 후기] 발표 지옥 해방의 날

미미유❤ 2025. 6. 27. 20:10

PM 부트캠프 10일차 후기


 

오늘은 대망의 PM 직무스터디 발표날...🥺

 

11시까지 PPT 제출이라서 11시까지 수정할 부분 있는지 검토도 하고 질의응답도 대비하는 시간을 가지고,

각자 파트를 맡아 발표를 하기로해서 12시 30분~1시까지 발표 맞춰보는 연습도 했다.

 

대망의 발표 시간!!

(위에 사진은 우리 조가 발표한 자료는 아니고 다른 조 발표하던 모습 찰칵했다. 발표할 때는 정신없어서 ㅋㅋㅋ)

 

회초리 맞을 각오로 발표를 했는데 피드백해주신 튜터님이 칭찬 지옥에 가두셔서 놀랐다👼

칭찬 잔뜩 받고 해피해피한 날이였다🥰

 

튜터님이 담임매니저님한테도 잘했다고 소문 내주셨다길래 기분 좋아서 찰칵😘

 

 

 

 

어~ SQL 오랜만이야...^^ SQL 공부 9일차


 

  User Segmentation과 조건별 수수료를 Subquery로 결합하는 실습

 

실습1

음식점의 평균 단가별 데이터를 세분화(segmentation)하고 그룹에 따라 수수료 연산해 줘 (평균단가/segmentation/ 수수료 연산)

수수료 : 0~5,000원 미만은 0.5% / 5000~20,000원 미만은 1% / 20,000~30,000원 미만은 2% / 30,000원 초가는 3%

select restaurant_name,
       price_per_plate*ratio_of_add "수수료"
from 
(
select restaurant_name,
       case when price_per_plate<5000 then 0.005
            when price_per_plate between 5000 and 19999 then 0.01
            when price_per_plate between 20000 and 29999 then 0.02
            else 0.03 end ratio_of_add,
       price_per_plate
from 
(
select restaurant_name, avg(price/quantity) price_per_plate
from food_orders
group by 1
) a
) b

 

 

구문만의 결과를 보고 싶을 때 보고 싶은 구문 드래그하고 실행(ctrl+enter) 하면 됨

 

 

실습2-1

음식점의 지역과 평균 배달시간을 구해줘

select restaurant_name,
       substr(addr, 1, 2) '시도',
       avg(delivery_time) avg_delivery_time
from food_orders
group by 1, 2

 

 

 

실습2-2

음식점의 지역과 평균 배달시간을 구해주고, 데이터를 세분화(segmention)해줘

select restaurant_name,
       '시도',
       avg_delivery_time,
       case when avg_delivery_time<=20 then '<=20'
            when avg_delivery_time>20 and avg_delivery_time<=30 then '20<x<=30'
            else '>30' end delivert_time_segment
from
(
select restaurant_name,
       substr(addr, 1, 2) '시도',
       avg(delivery_time) avg_delivery_time
from food_orders
group by 1, 2
) a

 

 

 

 

  복잡한 연산을 Subquery로 실습

 

실습1-1

음식 타입별로 총 주문수량과 음식점 수를 연산해 줘

select cuisine_type,
       sum(quantity) total_quantity,
       count(distinct restaurant_name) count_res
from food_orders
group by 1

 

 

실습1-2

음식 타입별로 총 주문수량과 음식점 수를 연산하고, 주문수량 별 수수료율을 산정해 줘

수수료 : 음식점수 5개 이상 주문수 30개 이상 → 수수료 0.5%
             음식점수 5개 이상, 주문수 30개 미만 → 수수료 0.8%
             음식점수 5개 미만주문수 30개 이상 → 수수료 1%
             음식점수 5개 미만 주문수 30개 미만 → 수수로 2%

select cuisine_type,
       total_quantity,
       count_res,
       case when count_res>=5 and total_quantity>=30 then 0.005
            when count_res>=5 and total_quantity<30 then 0.8
            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

 

 

 

실습2-1

음식점의 총 주문수량과 주문 금액을 연산해 줘

select restaurant_name,
       sum(quantity) sum_quantity,
       sum(price) sum_price
from food_orders
group by 1

 

 

실습2-1

음식점의 총 주문수량과 주문 금액을 연산해 주고, 주문 수량을 기반으로 수수료 할인율을 구해줘

할인조건 : 수량이 5개 이하는 10%

                수량이 15개 초과, 총 주문 금액이 300,000원 이상일 때 0.5%

                이 외에는 일괄 1%

select restaurant_name,
       sum_quantity,
       sum_price,
       case when sum_quantity<=5 then 10
            when sum_quantity>15 and sum_price>=300000 then 0.5
            else 0.01 end sidcount_rate
from
(
select restaurant_name,
       sum(quantity) sum_quantity,
       sum(price) sum_price
from food_orders
group by 1
) a