728x90

!! 시험에 잘 나옴 !!

 

*in 뒤에 해당 하는 값 보여줌, or랑 똑같음

in, not in 300, 500

> not을 붙이면 300, 500이 아닌 데이터를 보여줌


*like 특정 글자만 알 때,

like, not like

>F% 

% : 개수도 모를 때

_ : 글자를 모르지만 개수는 알 때

 

ex) 세번째가 A인 값의 개수 구하기

select count(*) from emp
where ename  like '__A%

 

*null 빈 값

null > is null, is not null. 사용 =는 사용하지 않음

null은 데이터에서 가장 큰 값으로 친다.

 

ex)null 값이 아닌 데이터 구하기

select * from emp
where comm is not NULL;

 

*order by 절

크기순으로 나열하는 절

ascending 오름차순(디폴트), descending 내림차순 순서대로

 

ex) 입사일이 가장 최근인 사람 구하기

select empno,ename,job,hiredate
from emp
order by hiredate desc;

 

 

 

728x90

+ Recent posts