스파르타코딩클럽에서 진행되는 데이터분석 내일배움캠프.
본캠프 참여 전 사전캠프 수강을 시작했다.
앞으로 매일 작성하게 될 TIL.
TIL을 통해 성실하게 포트폴리오를 만들고, 배운 것들을 복습하여 내것으로 흡수해나가고자 한다. 더이상의 다운그레이드는 없다! 이제 막 시작이지만 재취업하는 날까지 달려보겠다!
<TIL 작성법>
1. Problem : 어떤 문제가 있었는가
2. Try : 내가 시도한 것들은 무엇인가
3. Solve : 문제를 어떻게 해결하였는가
4. Figure Out : 무엇을 새롭게 알아냈는가
(TIL은 아무래도 개념 단계에서는 적용되지 않을 것 같다)
△email컬럼SQL 실습 프로그램은 DBeaver
https://dbeaver.io/download/
[실습] payments 테이블의 데이터 조회하기
select * from payments[실습] 주문 (food_orders) 테이블에서 order_id, price, quantity 를 가져와서
ord_no, 가격, 수량 으로 별명 지어주기select order_id order_no, price "가격", quantity "수량" from food_orders
where : 조건 필터링
ex) where age = 25
between : A와 B사이의 값
ex) age between 10 and 20
in : 포함하는 값
ex) age in(25, 27, 30)
like : 비슷한 값 모두(% 사용)
ex) name like '김%'
[실습] 1.고객 (customers) 테이블에서 나이가 40세 이상인 고객 조회하기
select * from customers where age >= 40
[실습] 2.주문 (food_orders) 테이블에서 주문 금액이 15,000원 미만인 고객 조회하기
select * from food_orders where price < 15000
[실습] 1.주문 (food_orders) 테이블에서 주문 금액이 20,000~30,000원 사이인 고객 조회하기
select * from food_orders where price between 20000 and 30000
[실습] 2. 주문 (food_orders) 테이블에서 B 로 시작하는 상점의 주문 조회하기
select * from food_orders where restaurant_name like 'B%'
[실습] 1.주문 (food_orders) 테이블에서 한국음식이면서, 가격이 30,000원 이상인 경우 조회
select * from food_orders where cuisine_type = 'Korean' and price >= 30000
[실습] 2.결제 (payments) 테이블에서 카드로 결제했거나, vat 율이 0.2 이하인 경우 조회
select * from payments where pay_type = 'card' or vat <= 0.2
[과제] 상품 준비시간이 20~30분 사이인, 한국음식점의 식당명과 고객번호 조회하기
select restaurant_name , customer_id from food_orders where food_preparation_time between 20 and 30 and cuisine_type = 'Korean'