<데이터베이스>
: 여러 사람들이 같이 사용할 목적으로 데이터를 담는 통
-> CRUD 기능 지원
C (Create) : 데이터의 생성
R (Read) : 저장된 데이터를 읽어오는 것
U (Update) : 저장된 데이터 변경
D (Delete) : 저장된 데이터 삭제
보기 편하게 정리해야함! 눈에 보기 편하게!! 회사마다 다름
select * from orders
where payment_method = 'kakaopay' => 문자열일 경우 작은 따옴표 꼭 붙여야함
그리고 : where ~ and ~
또는 : where ~ or ~
show tables : 어떤 테이블이 있는지 확인할 수 있음
1) 포인트가 20000보다 많은 유저
select * from point_users
where point > 20000
2) 황씨인 유저
select * from users
where name = '황**'
3) 웹개발 종합반이면서 결제수단이 card
select * from orders
where course_title = '웹개발 종합반' and payment_method = 'CARD'
<Count : 몇 개인지 세보기>
SELECT count(*) from orders
<Distinct와 Count 응용>
SELECT count(DISTINCT name)from users
<퀴즈>
1) 성이 남씨인 유저의 이메일만 추출하기
select email from users
where name = '남**'
2) Gmail을 사용하는 2020/07/12~13에 가입한 유저를 추출하기
select * from users
where email like '%gmail.com' and
created_at BETWEEN '2020-07-12' and '2020-07-14'
3) Gmail을 사용하는 2020/07/12~13에 가입한 유저 수 세기
select count(*) from users
where email like '%gmail.com' and
created_at BETWEEN '2020-07-12' and '2020-07-14'