A view exists only for a single query. Each time you use the name of a view, its table is recreated from existing data. A temporary table exists for the entire database session in which it was created. A view is automatically populated with the data retrieved by the query that defines it.
A view contains no data of its own but it is like a ‘window’ through which data from tables can be viewed or changed. A view is a query of one or more tables that provides another way of presenting the information. In layman’s terms, a view is a “stored query “. It is also called a derived table because it is derived from another table. Views do not store data rather they derive their data from tables on which they are based, referred to as the base table of the view. The view is stored as a SELECT statement in the data dictionary. Creating a view fulfills the requirement without storing a separate copy of the data because a view does not store any data of its own and always takes the data from a base table. as the data is taken from the base table, accurate and up-to-date information is required.
Advantages of views
Security
Each user can be given permission to access the database only through a small set of views that contain the specific data the user is authorized to see, thus restricting the user's access to stored data
Query Simplicity
A view can draw data from several different tables and present it as a single table, turning multi-table queries into single-table queries against the view.
Structural simplicity
Views can give a user a "personalized" view of the database structure, presenting the database as a set of virtual tables that make sense for that user.
Consistency
A view can present a consistent, unchanged image of the structure of the database, even if the underlying source tables are split, restructured, or renamed.
Data Integrity
If data is accessed and entered through a view, the DBMS can automatically check the data to ensure that it meets the specified integrity constraints.
Logical data independence.
View can make the application and database tables to a certain extent independent. If there is no view, the application must be based on a table. With the view, the program can be established in view of above, to view the program with a database table to be separated.
Disadvantages of views
Performance
Views create the appearance of a table, but the DBMS must still translate queries against the view into queries against the underlying source tables. If the view is defined by a complex, multi-table query then simple queries on the views may take considerable time.
Update restrictions
When a user tries to update rows of a view, the DBMS must translate the request into an update on rows of the underlying source tables. This is possible for simple views, but more complex views are often restricted to read-only.
When a table is dropped, associated view become irrelevant.
Since view are created when a query requesting data from view is triggered, its bit slow
When views are created for large tables, it occupy more memory .
No comments:
Post a Comment