VIEWS:
• An
Oracle VIEW, in essence, is a virtual table that does not physically exist.
Rather,
it is
created by a query joining one or more tables.
• It
reduces Number of hits to the database
• It
improves the performance of queries and database
Create VIEW
CREATE VIEW view_name AS
SELECT columns
FROM tables
[WHERE conditions];
EX:
CREATE VIEW V1
AS
SELECT ENAME,DNAME
FROM EMP,DEPT
WHERE EMP.DEPTNO=DEPT.DEPTNO;
GRANT CREATE VIEW TO SCOTT;
UPDATE VIEW:
CREATE OR REPLACE VIEW view_name AS
SELECT columns
FROM table
WHERE conditions;
EX:
CREATE OR REPLACE VIEW V1
AS
SELECT ENAME,LOC
FROM EMP,DEPT
WHERE EMP.DEPTNO=DEPT.DEPTNO
Drop VIEW
Once an Oracle VIEW has been created, you can drop it with
the Oracle DROP VIEW Statement.
Syntax:
DROP VIEW view_name;
EX:
DROP VIEW VIEW_NAME;