Previous Topic: ProcessingNext Topic: Example 2


Example 1

Create a read-only view with the specifications listed in the following:

  1. View name: PROJV1
  2. Column names: PROJNO, PROJNAME, PROJDEP, RESPEMP, EMPNO, FIRSTNME, MIDINIT, LASTNAME
  3. The view joins the tables PROJTBL and NAMETBL where a value in the RESPEMP column is equal to a value in the EMPNO column.

    Note: Since this view joins two tables, it is a read-only view.

    EXEC SQL
          CREATE VIEW PROJV1
               (PROJNO, PROJNAME, PROJDEP, RESPEMP,
                FIRSTNME, MIDINIT, LASTNAME)
          AS SELECT ALL
               PROJNO, PROJNAME, DEPTNO, EMPNO,
               FIRSTNME, MIDINIT, LASTNAME
          FROM PROJTBL, NAMETBL
          WHERE RESPEMP = EMPNO
    END-EXEC