Program.../Oracle

Oracle 비교연산자

Duritz 2009. 3. 13. 01:53

-- 비교 연산자
select *
from emp
where deptno=10; -- 같다

select *
from emp
where deptno <> 10; -- 같지않다 ( <>, !=, ^= ) 

select *
from emp
where not deptno = 10; -- column 명앞에 not 을 붙여서 같지 않다가 된다.

select ename, sal
from emp
where sal >= 3000; -- >= ~ 보다 크거나 같다.

select *
from EMP
where job='SALESMAN' -- 문자일경우에는 ' '를 해주어야 하고, Value 값은 대소문자를 잘 구분해야한다.

select 'saLesMan', upper('saLesMan'), -- upper 모든 문자를 대문자로 표시
       lower('saLesMan'), -- lower 모든 문자를 소문자로 표시
    initcap('saLesMan') -- initcap 맨앞문자만 대문자로 표시
from dual;

select *
from EMP
where upper(job)=upper('saLesMan'); -- 검색할 조건을 모두 대문자로 변경후 검색한다.

update emp set job='sAlesMaN'
where empno=7499;