1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | desc Employees; /*Employees 테이블 속성 정보를 보여줌(description)*/ select * from tab; /* table 조회*/ select employee_id,salary from Employees where last_name= 'Smith' ; select employee_id as "ID" from Employees; select employee_id "ID" from Employees; select distinct job_id from Employees; /* distinct : 중복 배제*/ /*[입사일이 04/01/01 이후인 입사자들의 정보]*/ select First_name,Last_name,hire_date from Employees where hire_date >= '04/01/01' ; /*[ not ]*/ select First_name,Last_name,department_id From Employees Where not (department_id = 50); select First_name,Last_name,department_id From Employees Where department_id <> 50; /*[salary가 4000 ~ 8000인 사람들 정보]*/ select First_name,Last_name,department_id From Employees Where salary >= 4000 and salary <= 8000; select First_name,Last_name,department_id From Employees Where salary between 4000 and 8000; /*[ in ]*/ select First_name,Last_name,department_id From Employees Where salary = 6500 or salary = 7700 or salary = 13000; select First_name,Last_name,department_id From Employees Where salary in (6500,7700,13000); /*[ like ]*/ /*First_name이 D로 시작하는 사람 정보*/ select First_name,Last_name,department_id From Employees Where First_name like 'D%' ; --_a% : _는 아무거나 한글자 두번째 글자는 a 그 뒤는 아무거나 select First_name, Last_name from Employees where First_name like '_a%' ; -- [IS NULL] commission_pct값이 null인 사람을 뽑아냄(NULL은 = <>를 사용하면 안된다. 제대로비교불가) select First_name, Last_name from Employees WHERE commission_pct IS NULL ; --[ IS NOT NULL ] : commission_pct가 null이 아닌 직원의 이름 출력 select First_name, Last_name from Employees WHERE commission_pct IS NOT NULL ; --[ ORDER BY ] : 정렬 (desc(내림차순), asc(오름차순)) select Employee_id, last_name from Employees ORDER BY Employee_Id desc ; |
'스터디 > DB(ORACLE)' 카테고리의 다른 글
ORACLE 날짜함수, 변환함수, decode(), case() (0) | 2017.09.04 |
---|---|
ORACLE 문자열 함수 (0) | 2017.09.04 |
ORACLE 집계함수, 숫자함수 (0) | 2017.09.04 |
이채남저 오라클실습 자료(개인 보관용) (1) | 2017.08.31 |
ORACLE DB 특수문자 제거, 숫자만 빼고 다 제거 쿼리문 (1) | 2017.08.22 |