Database Reference
In-Depth Information
Views are comprised of one or more tables or views and they
themselves contain no data and the underlying tables are called
based tables. Creating views is exactly similar to creating tables,
the only difference is we use CREATE VIEW statement instead
of CREATE TABLE statement.
Example:
CREATE VIEW emp_view AS
SELECT *
FROM employees
WHERE department_id = 20;
Dropping a view will not drop the underlying base tables or
views. Also you can insert and update the base tables through the
view provided the constraints implemented on the based tables
won't get violated. We can use any of the form of Join-based
SELECT statement to have the view based on more than one
table.
We can also create a read only view using the WITH READ
ONLY clause and grant access to users, then they would not be
able to modify the base tables.
Example:
CREATE VIEW emp_view AS
SELECT *
FROM employees
WHERE department_id = 20
WITH READ ONLY;
Example:
DROP VIEW emp_view;
Dropping view neither drops base tables or views nor the data
residing in each of those base tables.
Search WWH ::




Custom Search