SQL/ORACLE SQL

SELECT : 검색 WHERE 조건

HicKee 2022. 11. 1. 16:22

TABLE EXAMPLE 사용

 

select 컬럼명  from 테이블명
where 조건

 

월급이 1500인 사원의 사원번호, 사원명, 월급

select eno 사원번호, ename 사원명 ,salary 월급 from employee
where salary = 1500;

월급이 1500이 넘는 사원의 사원번호, 사원명, 월급 (1500 포함 X)

select eno 사원번호, ename 사원명 ,salary 월급 from employee
where salary > 1500;

1500 포함

select eno 사원번호, ename 사원명 ,salary 월급 from employee
where salary >= 1500;

같지 않다 <> , != , ^=

select eno 사원번호, ename 사원명 ,salary 월급 from employee
where salary <> 1500;

select eno 사원번호, ename 사원명 ,salary 월급 from employee
where salary != 1500;

select eno 사원번호, ename 사원명 ,salary 월급 from employee
where salary ^= 1500;

varchar 일 경우 (' ') 필요함

select *from employee 
where ename = '스콧';

날짜 데이터 조회 (' ') 필요함 

        hiredate - date타입이기 때문

select * from employee
where hiredate <= '1981/01/01';

 

논리 연산자  AND, OR, NOT

--둘다 true
select *from employee
where dno = 10 and job = '매니저';
--하나만 true
select * from employee
where dno  = 10 or job ='매니저';
--부서번호가 10이 아닌 사원
select * from employee
where not dno = 10;

'SQL > ORACLE SQL' 카테고리의 다른 글

SELECT : 검색 LIKE 그리고 IS NULL  (0) 2022.11.01
SELECT : 검색 BETWEEN AND 그리고 IN  (0) 2022.11.01
SELECT : 검색  (0) 2022.11.01
TABLE EXAMPLE  (0) 2022.11.01
연습 - 테이블 생성  (0) 2022.11.01