250x250
Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
Tags
- Framework
- 레퍼클래스
- 캡슐화
- 요시
- Spring
- Interface
- jvm
- 깃
- 스프링부트
- 내일배움캠프
- 프레임워크
- springboot
- 스파르타코딩클럽
- 자바
- 함바그
- 스파르타코딩클럽 #사전캠프
- static
- Java
- til #데이터베이스 #sql
- 스파르타사전캠프
- validation
- optional
- 스터디카페
- Til
- 피드백
- 키오스크
- 메모리구조
- 깃헙
- 스파르타코딩클럽 #개발자 #백엔드
- 사전캠프
Archives
- Today
- Total
John's Code Journey
[TIL] 내일배움캠프 250221 본문
728x90
오늘은 sql 복습을 했다.
3주차 숙제
다음의 조건으로 배달시간이 늦었는지 판단하는 값을 만들어주세요.
- 주중 : 25분 이상
- 주말 : 30분 이상
select order_id,
restaurant_name,
day_of_the_week,
delivery_time,
case when day_of_the_week='Weekday' and delivery_time>=25 then 'Late'
when day_of_the_week='Weekend' and delivery_time>=30 then 'Late'
else 'On-time' end "지연여부"
from food_orders
4주차 숙제
식당별 평균 음식 주문 금액과 주문자의 평균 연령을 기반으로 Segmentation 하기
- 평균 음식 주문 금액 기준 : 5,000 이하 / ~10,000 / ~30,000 / 30,000 초과
- 평균 연령 : ~ 20대 / 30대 / 40대 / 50대 이상
select restaurant_name,
case when price <=5000 then 'price_group1'
when price >5000 and price <=10000 then 'price_group2'
when price >10000 and price <=30000 then 'price_group3'
when price >30000 then 'price_group4' end price_group,
case when age <30 then 'age_group1'
when age between 30 and 39 then 'age_group2'
when age between 40 and 49 then 'age_group3'
else 'age_group4' end age_group
from
(
select a.restaurant_name,
avg(price) price,
avg(age) age
from food_orders a inner join customers b on a.customer_id=b.customer_id
group by 1
) t
order by 1
'Today I Learned > 스파르타 내일배움캠프' 카테고리의 다른 글
[TIL] 250225 (1) | 2025.02.25 |
---|---|
[TIL] 250224 (1) | 2025.02.24 |
[TIL] 내일배움캠프 250220 (0) | 2025.02.20 |
[TIL] 내일배움캠프 250219 (3) | 2025.02.19 |
[TIL] 내일배움캠프 250218 (0) | 2025.02.18 |