336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.
Simple Views and Complex Views
- the subquery can contain complex SELECT syntax, including joins, groups, and subqueries.
- default name of the constraint is Sys_Cn
- REPLACE : drop and re-create.
Creating a view by using column alias in the subquery.
or
- A simple view
Derives data from only one table
No functions or groups
DML operations through the view
- A complex view
more than one table
contains functions and groups
DML operation might be limited
CREATE [OR REPLACE] [FORCE | NOFORCE] VIEW view_name [(alias[, alias] ... )]
AS subquery
[WITH CHECK OPTION [CONSTRAINT constraint]]
[WITH READ ONLY [CONSTRAINT constraint]];
AS subquery
[WITH CHECK OPTION [CONSTRAINT constraint]]
[WITH READ ONLY [CONSTRAINT constraint]];
FORCE : creates the view regardless of whether or not the base table exist.
NOFORCE : create the view only if the base table exist. (default)
WITH CHECK OPTION : specifies that only those rows that are accessible to the view can be inserted or updated.
constraint : is the name assigned to the CHECK OPTION constraint
WITH READ ONLY : ensure that no DML operations can be performed on this view
CREATE VIEW empvu80
AS
SELECT employee_id, last_name, salary
FROM employees
WHERE department_id = 80;
AS
SELECT employee_id, last_name, salary
FROM employees
WHERE department_id = 80;
- the subquery can contain complex SELECT syntax, including joins, groups, and subqueries.
- default name of the constraint is Sys_Cn
- REPLACE : drop and re-create.
Creating a view by using column alias in the subquery.
CREATE VIEW salvu50
AS
SELECT employee_id ID_NUMBER, last_name NAME,
salary*12 ANN_SALARY
FROM employees
WHERE department_id = 50;
AS
SELECT employee_id ID_NUMBER, last_name NAME,
salary*12 ANN_SALARY
FROM employees
WHERE department_id = 50;
or
CREATE VIEW salvu50 (ID_NUMBER, NAME, ANN_SALARY)
AS
SELECT employee_id , last_name,
salary*12
FROM employees
WHERE department_id = 50;
AS
SELECT employee_id , last_name,
salary*12
FROM employees
WHERE department_id = 50;
'Oracle' 카테고리의 다른 글
Rules for Performing DML Operations on a View (0) | 2006.11.24 |
---|---|
Views (0) | 2006.11.24 |
Dropping a Table (0) | 2006.11.24 |
Dropping a Table (0) | 2006.11.24 |
Creating a Table by Using a Subquery (0) | 2006.11.24 |