VIEWS
To reduce redundant data to the minimum possible, Oracles allows the creation of an object called a view. A view is mapped, to SELECT sentence. The table on which the view is based is described in the FORM clause of the SELECT statement.
Views are tables whose contents are taken or derived from other tables. Views themselves do not contain data. They just act as a window through which certain contents of a table can be viewed. Also, one can manipulate the contents of the original table these views.
Views can be used to insert, update and delete table data as well as view data. If a view is used to only look at table data and nothing else the view is called a READ-ONLY view.
A view is a logical table based on a table or another view. A view contains no data of its own but is like a window through which data from tables can be viewed or changed.
We use views :
To restrict data access
To make complex queries easy
To provide data independence
To present different vies of the same data
CREATION OF VIEW
SYNTAX: -
CREATE VIEW viewname AS SELECT columnname, columnname
FROM tablename WHERE columnnmae=expression list;
GROUP BY grouping criteria HAVING predicate
EXAMPLE: -
SQL> CREATE VIEW bal_due AS SELECT * FROM banking1;
View created.
SELECTING A DATA SET FROM A VIEW
SYNTAX: -
SELECT columnname, columnname FROM viewname;
EXAMPLE: -
SQL> SELECT name,accountno,id FROM bal_due;
USES OF VIEWS
Views restrict access to the database. If you want users to see some but not all data of a table, you can create a view showing only certain fields.
Critical data in the base table is safe guarded as access to such data can be controlled using views.
To reduce redundant data to the minimum possible, Oracles allows the creation of an object called a view. A view is mapped, to SELECT sentence. The table on which the view is based is described in the FORM clause of the SELECT statement.
Views are tables whose contents are taken or derived from other tables. Views themselves do not contain data. They just act as a window through which certain contents of a table can be viewed. Also, one can manipulate the contents of the original table these views.
Views can be used to insert, update and delete table data as well as view data. If a view is used to only look at table data and nothing else the view is called a READ-ONLY view.
A view is a logical table based on a table or another view. A view contains no data of its own but is like a window through which data from tables can be viewed or changed.
We use views :
To restrict data access
To make complex queries easy
To provide data independence
To present different vies of the same data
CREATION OF VIEW
SYNTAX: -
CREATE VIEW viewname AS SELECT columnname, columnname
FROM tablename WHERE columnnmae=expression list;
GROUP BY grouping criteria HAVING predicate
EXAMPLE: -
SQL> CREATE VIEW bal_due AS SELECT * FROM banking1;
View created.
SELECTING A DATA SET FROM A VIEW
SYNTAX: -
SELECT columnname, columnname FROM viewname;
EXAMPLE: -
SQL> SELECT name,accountno,id FROM bal_due;
USES OF VIEWS
Views restrict access to the database. If you want users to see some but not all data of a table, you can create a view showing only certain fields.
Critical data in the base table is safe guarded as access to such data can be controlled using views.