🔴🟠
like : 특정 값과 유사한 집합 출력
not like : 특정 값과 유사하지 않은 집합 출력
% : 문자의 갯수에 상관 없이 매칭으로 판단
_ : 한 개의 문자에 대해 매칭으로 판단
(1).
select
first_name
from
customer
where
first_name
like
'Jen%'
=> %는 문자의 갯수에 상관 없이 매칭으로 판단하기 때문에,
Jenny, Jennifer, Jena 등 Jen으로 시작하는 fisrt_name들이 출력된다.
(2).
select
first_name
from
customer
where
first_name
like
'Jen_'
=> _는 한 개의 문자에 대해 매칭으로 판단하기 때문에,
Jena, Jeny 등 Jen으로 시작하고 뒤에 한 개의 문자가 있는 first_name들만 출력된다.
(3).
select
first_name
from
customer
where
first_name
like
'Jen__'
=> _는 한 개의 문자에 대해 매칭으로 판단하기 때문에,
'__'의 경우, 두 개의 문자에 대해 매칭으로 판단한다.
따라서, Jenny, Jenie 등 Jen으로 시작하고 뒤에 두 개의 문자가 있는
first_name들만 출력된다.
(4).
select
first_name
from
customer
where
first_name
not like
'Jen%'
=> 'Jen'으로 시작하지 않는 모든 first_name을 출력한다.
is null : null인지 판단
is not null : null이 아닌지 판단
*= null은 사용되지 않으니 유의!
(1).
select *
from
customer
where
first_name is null
;
=> customer 테이블에서, first_name에 null값이 존재하는 모든 컬럼을 출력한다.
(2).
select *
from
customer
where
first_name is not null
;
=> customer 테이블에서, first_name에 null값이 존재하지 않는 모든 컬럼을 출력한다.