자주 사용하는 테이블 및 구문을 저장해 두는 객체?
--(주의) 사용자가 ctreate view 라는 권한을 가지고 있어야 만들수 잇다 (resource에 포함되어 있지 않음)
--(주의) view는 결과집합에 중복된 컬러명이 잇으면 생성이 안된다.
-★★권한 부여하는 코드 --시스템계정에서 부여해야함!!!★★
grant create view to kh;
--같이도 사용하지만 나눠쓰는 경우가 많다면 테이블을 분할할 수 없으니 가상의 테이블로 분리
--create [or replace] view 이름 as 조회구문;
-- or replace : 있어도 덮어쓰기
ex) 예시를 들어보는게 더좋을꺼같다.
select * from exam where subject = '프로그래밍언어활용';
select * from exam where subject = '프로그래밍언어활용' and student = '피카츄';
select * from exam where subject = '프로그래밍언어활용' and type = '서술형';
이러한 조회 구문이 있을때
" select * from exam where subject = '프로그래밍언어활용' " 요부분이 계속 반복해서 나온다.
이부분을 가상의 테이블에 저장을한후 사용
create or replace view program_exam as select * from exam where subject = '프로그래밍언어활용
create view program_exam as select * from exam where subject = '프로그래밍언어활용
--> 생성
select * from progame_exam where student ='피카츄';
select * from progame_exam where type '서술형';
같은결과 값이 나온다..
select * from exam where subject = '프로그래밍언어활용' and student = '피카츄';
select * from exam where subject = '프로그래밍언어활용' and type = '서술형';
'[DBMS] > - Oracle' 카테고리의 다른 글
[Oracle]Index (0) | 2022.05.30 |
---|---|
[Oracle]시퀸스 (sequence) (0) | 2022.05.30 |
[Oracle] JOIN ( INNER JOIN , OUTER JOIN) (0) | 2022.05.30 |
[Oracle]DML 수정 (update) , 삭제 (delete) (0) | 2022.05.30 |
[Oracle]Foregin Key (외래키) (0) | 2022.05.30 |
댓글