View
is a logical representation of table when we don’t want to give the full access
of a table, not even to see the full table data only part of the table columns
then view is the way when we replicate the desired table columns.
View is a logical
table based on one or more tables or views. A view contains no data itself. The
tables upon which a view is based are called base tables.
Example:-
CREATE OR REPLACE
FORCE VIEW emp_view ("EMP_ID", "EMP_NAME",
"EMP_SAL", "EMP_ADDRESS")
AS
SELECT "EMP_ID", "EMP_NAME",
"EMP_SAL", "EMP_ADDRESS" FROM emp
WHERE emp_id='101';
Here
FORCE keyword is used if we are creating
several views that reference each other and we don't want to spend time to
determine in which order they should be created. Otherwise don’t use ‘FORCE’
keyword.
No comments:
Post a Comment