A view on a single table

You can create views on individual tables when you need to limit access to particular columns.

Examples

Begin general-use programming interface information.
Example
Assume that you want to create a view on the DEPT table. Of the four columns in the table, the view needs only three: DEPTNO, DEPTNAME, and MGRNO. The order of the columns that you specify in the SELECT clause is the order in which they appear in the view:
CREATE VIEW MYVIEW AS
  SELECT DEPTNO,DEPTNAME,MGRNO
  FROM DEPT;
Example
In the preceding example, no column list follows the view name, MYVIEW. Therefore, the columns of the view have the same names as those of the DEPT table on which it is based. You can execute the following SELECT statement to see the view contents:
SELECT * FROM MYVIEW;
The result table looks like this:
DEPTNO     DEPTNAME                  MGRNO
======     =====================     ======
A00        CHAIRMANS OFFICE          000010
B01        PLANNING                  000020
C01        INFORMATION CENTER        000030
D11        MANUFACTURING SYSTEMS     000060
E21        SOFTWARE SUPPORT          ------
End general-use programming interface information.