VIEW
- 가상 테이블
- 실체가 없는 테이블 != dual
- 다른 테이블에 접근하기 위한 테이블
- table <--------- view <----------- user
- 속도가 빠르다.
- 한 개의 view로 여러개의 테이블을 검색할 수 있다.
- 제한 설정이 가능하다. → read only
int array[] = { 1,2,3 };
int alias[] = array;
alias[0] --> 1
alias[0] = 11;
array[0] --> 11
- 뷰의 개념
-- or replace : 생성하고 수정한다
create or replace view ub_test01 as select job_id, job_title, min_salary from jobs;
insert into ub_test01(job_id, job_title, min_salary) values('DEVELOPER', '개발자', 10000);
select * from ub_test01; -- 창문을 통해 확인
select * from jobs; -- 직접 확인
- 값의 확인은 view가 아닌 jobs table에서 확인해야 한다.
-- join하기 번거로울 시 미리 join된 view 생성
create or replace view dept_emp_location_view
as select employee_id, first_name, d.department_id, department_name, l.city
from employees e, departments d, locations l
where e.department_id = d.department_id and d.location_id = l.location_id;
select * from dept_emp_location_view where employee_id = 103;
- view 를 통해 미리 여러 테이블을 join하여 편하게 접근 가능
'DB' 카테고리의 다른 글
[MySQL] 제어문, Cursor (0) | 2022.06.21 |
---|---|
[MySQL] PL (0) | 2022.06.21 |
[MySQL] 무결성 (0) | 2022.06.20 |
[MySQL] create, drop, alter / insert, delete, select, update (0) | 2022.06.20 |
[MySQL] Limit (0) | 2022.06.17 |