Sequence(SEQ), 동의어
sequence : 유일한 값을 생성해주는 Oracle Object baseball +1 1001 -> 1002 -> 1003 ex) 회원번호, 게시판 관리번호 등 초기화 불가능, 삭제 후 다시 생성 int count = 1; count++; --EMPLOYEES테이블 시퀀스에 값 넣어보기 ->nextval을 통해 마지막 사원번호 다음 번호로 삽입됨. INSERT INTO employees(EMPLOYEE_ID, LAST_NAME, EMAIL, HIRE_DATE, JOB_ID) VALUES(EMPLOYEES_SEQ.nextval, '홍', 'HGD@NAVER.COM', '91/10/12', 'IT_PROG'); --nextval을 통해 마지막 사원번호 다음 번호로 삽입됨. --sequence의 생성 CR..
순위함수
SELECT 절 SELECT 컬럼, 함수, 그룹함수, SUB QUERY, OVER() PARTITION BY FROM 테이블, SUB QUERY [ WHERE ] 조건 IN AND ALL ANY LIKE 123456 순서 매겨짐 (코드) SELECT first_name, salary, RANK()OVER(ORDER BY salary DESC) AS RANK, DENSE_RANK()OVER(ORDER BY salary DESC) AS DENSE_RANK, ROW_NUMBER()OVER(ORDER BY salary DESC) AS ROW_NUMBER FROM employees; --ROWNUM (1,2,3,4,5,6,7,.... ) SELECT ROWNUM, employee_id, first_name FRO..
특수 Query
-- CASE DECODE = SWITCH --1번 SELECT employee_id, first_name, phone_number, CASE SUBSTR(phone_number, 1, 3) WHEN '515' THEN '서울' WHEN '590' THEN '부산' WHEN '659' THEN '광주' WHEN '603' THEN '대전' ELSE '기타' END AS "지역" FROM employees; --2번 SELECT employee_id, first_name, phone_number, CASE WHEN SUBSTR(phone_number,1,3) = '515' THEN '서울' WHEN SUBSTR(phone_number,1,3) = '590' THEN '부산' WHEN SUBSTR(phone..