개발일지

SQL 기초 강의

아크미르 2022. 1. 5. 20:51

보면 기부니가 조크든요

같지 않다 구문

select * from orders
where course_title != "같지않음";

 

범위 지정하여 조건 걸기

select * from orders
where created_at between "2020-07-13" and "2020-07-15";

 

포함 조건 걸기

select * from checkins 
where week in (1, 3);

 

패턴 (문자열 규칙) 조건 걸기

select * from users 
where email like '%daum.net';

일부 데이터만 가지고 오기

limit

중복값 제거하기

distinct

select distinct(payment_method) from orders

 

몇개인지 숫자 세기

select count(*) from orders

중복값을 제거하고 몇개인지 숫자 세기

select distinct(name) from users 중복을 제거한 값

중복을 제거한 수 세기

select count(distinct(name)) from users