Views
A view is a synthetic table. You can query it as if it were a table, and in some cases, you can update it as if it were a table. However, it is not a table. It is a synthesis of the data that exists in real tables and other views.
The basis of a view is a SELECT statement. When you create a view, you define a SELECT statement that generates the contents of the view at the time you access the view. A user also queries a view with a SELECT statement. In some cases, the database server merges the select statement of the user with the one defined for the view and then actually performs the combined statements. For information about the performance of views, see your Informix® Performance Guide.
- To restrict users to particular columns of tables
You name only permitted columns in the select list in the view.
- To restrict users to particular rows of tables
You specify a WHERE clause that returns only permitted rows.
- To constrain inserted and updated values to certain ranges
You can use the WITH CHECK OPTION (explained on page Use the WITH CHECK OPTION keywords) to enforce constraints.
- To provide access to derived data without storing redundant data
in the database
You write the expressions that derive the data into the select list in the view. Each time you query the view, the data is derived anew. The derived data is always up to date, yet no redundancies are introduced into the data model.
- To hide the details of a complicated SELECT statement
You hide complexities of a multitable join in the view so that neither users nor application programmers must repeat them.