IN연산자
- 컬럼의 값이 복수개로 주어진 값 중 어느 하나와
일치하면 전체가 참(TRUE)을 반환\
(사용형식)
컬럼명(표형식) IN (값1, 값2, ...)
select A.emp_name as 사원명,
A.department_id as 부서코드,
B.department_name as 부서명,
C.job_title as 직무명
from employees A, departments B, JOBS C
where A.department_id IN (30,40,60)
and A.department_id = B.department_id
and A.job_id = C.job_id;
ANY(SOME) 연산자
- 컬럼의 값이 복수개로 주어진 값 중 어느 하나와
일치하면 전체가 참(TRUE)을 반환
(사용형식)
컬럼명(표현식) 관계연산자 ANY|SOME (값1, 값2, ...)
- OR 연산자로 변환가능
- IN 연산자로 변환할때 관계연산자는 생략
select A.emp_name as 사원명,
A.department_id as 부서코드,
B.department_name as 부서명,
C.job_title as 직무명
from employees A, departments B, JOBS C
where A.department_id = ANY (30,40,60)
and A.department_id = B.department_id
and A.job_id = C.job_id;
select A.emp_name as 사원명,
A.department_id as 부서코드,
B.department_name as 부서명,
C.job_title as 직무명
from employees A, departments B, JOBS C
where A.department_id = SOME (30,40,60)
and A.department_id = B.department_id
and A.job_id = C.job_id;