What is a view?
Essentially, a view is a stored query that selects data from specified tables. The difference between a view and a regular query executed by a user or client application is that views are stored in the database and, therefore, can have permissions defined on them.
The following are some reasons you would use views:
- Views can provide subsets of rows or columns in a predefined way. This reduces the volume of data transferred from the database to the client, which can improve performance.
- Views allow you to codify common queries in the database and make them available to multiple users. This reduces the need for users to construct their own complex queries.
- Views can join data from multiple business tables or other views.
- You can use aggregation functions to summarize data in views. This also reduces the volume of data transferred from the database to the client, which can improve performance.
- You can grant users access rights (such as SELECT) to views in the same way as to tables. Therefore, you can use views to control access to rows or columns in business tables.
Views exist as objects in the database. Changes that are made to the schema of the underlying table or tables do not get reflected in the view. To include additional columns in a view, you must redefine the view to include those columns.