rabo93 2025. 1. 20. 09:42

- null값을 다른값으로 바꾸는 함수 
nvl(null인 컬럼, 바꿀 값) => nvl(컬럼명, 0) == mysql에서는 ifnull과 같음

- 테이블 삭제 시, 휴지통에서 삭제된 테이블 조회 가능
drop table 테이블명;
> show recyclebin;
> flashback table 테이블명 to before drop;


- Top-N 문법 => 서브쿼리에 order by절 사용 가능!
select rownum, 컬럼명1, 컬럼명2
from ( select 컬럼명1, 컬럼명2
  from 테이블명
  where 조건문
  order by 컬럼명 [asc | desc] )
where rownum <= N;

- alter view 없음!
- create[or replace] view 뷰명 as subquery;
- drop view 뷰명;

- Sequence (자동으로 고유한 번호를 반환해주는 번호 생성기 = auto increment)
create sequence 시퀀스명
increment by N  // 시퀀스 번호 간격, default = 1
start with N // 시퀀스 번호의 시작값, default = 1
maxvalue N // 시퀀스 번호의 최대값
minvalue N // 시퀀스 번호의 최소값
cycle // 시퀀스 순환 여부
cache N // default => cache 20
사용방법 : 시퀀스명.nextval, 시퀀스명.currval

- index


- Data Dictionary 
자주쓰는 데이터사전 뷰
user_tables, 
user_tab_columns
user_constraints
user_views
...