Skip to content

Latest commit

 

History

History
58 lines (47 loc) · 1.38 KB

연산자.md

File metadata and controls

58 lines (47 loc) · 1.38 KB

연산자

🎠산술 연산자

+ - * / mod(값, 나눌 수)

select mod(7,3) from dual;

🎡관계 연산자

> < >= <= != =

🎢조건 연산자

and or not 컬럼명 between 최소 and 최대


컬럼명 in (값, 값, ..)

select * from emp2 where position in ('과장', '부장');
select * from emp2 where deptno not in ('1000', '1005', '1011');

컬럼명 like '와일드카드문자열'

  • _: 한 글자, % : 0개 이상
select name, id from professor where id like '%-_'; -- only-u

컬럼명 연산자 any(값1, 값2, ...)

  • 검색 결과와 하나 이상이 일치하면 참
select * from professor where pay > any(200,300,400);

컬럼명 연산자 all(값1, 값2, ...)

  • 검색 결과와 모든 값이 일치하면 참
select * from professor where pay > all(200,300,400);

🎢null 연산자

is null is not null


nvl(값, 대치값)

  • 값에 null이 있으면 대치값으로 변경
select nvl(bonus,0), nvl(bonus+200,200) from professor;

nvl2(값, 지정값1, 지정값2)

  • 값에 null이 아닌 경우 지정값1을 출력하고, null인 경우 지정값2을 출력 한다.
select bonus, nvl2(bonus,bonus+10,0) from professor;