-
SQL 학습(2) - Where절 조건문Learning with online/SQL 2022. 10. 30. 17:14
select * from point_users
where point > 20000'point > 20000' 조건문 쿼리 결과
*** select 추출할 행 from 테이블
where 조건식
-- '아닌' !=
select * from orders
where course_title = '웹개발 종합반' and payment_method != 'CARD';
-- '범위' between ~ and
select * from orders
where created_at between '2020-07-13' and '2020-07-15';
-- '포함' in ( )
select * from checkins
where week in (1, 3)
-- '패턴' like <% ,,,>
select * from users
where email like '%@daum.net';
-- 그외의 문법
-- limit ( == 파이썬의 head 함수)
select * from orders o where payment_method = 'kakaopay'
limit 5;
-- distinct (중복제거, 도메인 확인)
SELECT DISTINCT payment_method from orders;
SELECT DISTINCT(payment_method) from orders;
-- count
select count(*) from orders o;-- count 와 distinct 의 활용
select count(distinct(name)) from users;
구분된 행의 개수 추출 'Learning with online > SQL' 카테고리의 다른 글
SQL 학습(3) - Group by, Order by(작성중) (0) 2022.11.02 SQL 학습(1) - 설치 및 환경설정 (0) 2022.10.30 SQL 학습시작(feat.스파르타 코딩클럽) (0) 2022.10.30