select * from orders
select course_title from orders
- '같음' 조건
select * from orders
where course_title = '앱개발 종합반'
- '같지 않음' 조건
select * from orders
where course_title != '웹개발 종합반'
- '이상' 조건
select * from orders
where created_at >= '2020-08-01'
- '범위' 조건
select * from orders
where created_at between '2020-07-13' and '2020-07-15'
- '포함' 조건
select * from orders
where payment_method in('kakaopay','CARD')
- '패턴' 조건
select * from orders
where email like '%naver.com'
- limit
일부 데이터만 가져오기
select * from orders
limit 5
- distinct
중복 데이터 제외하고 가져오기
(데이터 종류 보고싶을 때)
select distinct(payment_method) from orders
- count
데이터 숫자 세기
select count(*) from orders
- distinct와 count 같이 쓰기
select count(distinct(payment_method)) from orders
문법이 익숙하진 않지만 조금 고민하면 답을 찾을 수 있는 정도라 어렵진 않았다.
어디서 어떻게 데이터를 추출해야 하는지 생각하는 과정이 재미있다.