Views are logical tables of data extracted from existing tables. It can be queried just like a table, but does not require disk space. It can be thought of as either a virtual table or a stored query. Also the data accessible through a view is not stored in the database as a distinct object. What is stored in the database is a SELECT statement. The result set of the SELECT statement forms the virtual table returned by the view.
Syntax: CREATE or REPLACE VIEW view-name AS query; Example: CREATE VIEW EMP_VIEW AS SELECT emp_no, emp_name from emp;
Syntax: SELECT * FROM VIEW_NAME; Example: SELECT * FROM EMP_VIEW;
Syntax: DESC VIEW_NAME; Example: DESC EMP_VIEW;
Syntax: DROP VIEW VIEW-NAME; Example: DROP VIEW EMP_VIEW;
CREATE OR REPLACE VIEW EMP AS SELECT * FROM CUSTOMER WHERE CITY = 'BANGALORE' WITH CHECK OPTION;
SQL>SELECT * FROM USER_VIEWS;
Prof. Ashay Dharwadker