Views to customize what data users see
A view offers an alternative way of describing data that exists in one or more tables.
Some users might find that no single table contains all the data they need; rather, the data might be scattered among several tables. Furthermore, one table might contain more data than users want to see, or more than you want to authorize them to see. For those situations, you can create views.
You might want to use views for a variety of reasons:
- To limit access to certain kinds of data
You can create a view that contains only selected columns and rows from one or more tables. Users with the appropriate authorization on the view see only the information that you specify in the view definition.
Example: You can define a view on the EMP table to show all columns except SALARY and COMM (commission). You can grant access to this view to people who are not managers because you probably don't want them to have access to salary and commission information.
- To combine data from multiple tables
You can create a view that uses UNION or UNION ALL operators to logically combine smaller tables, and then query the view as if it were one large table.
Example: Assume that three tables contain data for a period of one month. You can create a view that is the UNION ALL of three fullselects, one for each month of the first quarter of 2004. At the end of the third month, you can view comprehensive quarterly data.
You can create a view any time after the underlying tables exist. The owner of a set of tables implicitly has the authority to create a view on them. A user with administrative authority at the system or database level can create a view for any owner on any set of tables. If they have the necessary authority, other users can also create views on a table that they did not create.