A view is a virtual table that is derived from one or more tables. A view is essentially a stored query. You can access a view to query data from the tables on which the view is based. This topic describes the concepts, benefits, characteristics, and usage of views.
A view retrieves data from the tables on which it is based. These tables are called base tables. Base tables can be tables or other views. All operations performed on a view affect the base tables. You can use views in most scenarios where you use tables.
Benefits
Views allow you to customize the presentation of data for different users. The following list describes the benefits of views:
You can define frequently queried data as views to simplify operations. Database queries may use aggregate functions, display information about additional fields, and reference other tables. As a result, the SQL statements can be rather complex. To avoid frequently executing these queries, you can create a view to simplify the query process. To obtain the desired query result after the view is created, execute the
SELECT * FROM view_namestatement.You can only query and modify data displayed in the view. This improves data security. A view is a data set that is automatically updated based on changes in the base tables. As a virtual table, a view does not physically exist and displays only the result set of a query. Therefore, you can choose not to display sensitive fields of the base tables to users.
A view is logically independent of the data structure of the base tables. Views allow applications to be independent of database tables. If views are not used, applications depend on real tables. After views are introduced, applications depend on views but not on real tables. In other words, views separate applications from database tables.
Characteristics
Unlike tables, views do not occupy storage space or store data. A view is defined by a query that extracts or derives data from the base tables referenced by the view. Therefore, a view requires no storage other than storage for the query that defines the view in the data dictionary.
A view depends on its referenced objects. If you drop, update, or re-create a base table of a view, the database determines whether the new base table is acceptable to the view definition.