Table designators

A qualifier that designates a specific object table is called a table designator. The clause that identifies the object tables also establishes the table designators for them.

For example, the object tables of an expression in a SELECT clause are named in the FROM clause that follows it:

   SELECT CORZ.COLA, OWNY.MYTABLE.COLA
     FROM OWNX.MYTABLE CORZ, OWNY.MYTABLE

Table designators in the FROM clause are established as follows:

  • A name that follows a table or view name is both a correlation name and a table designator. Thus, CORZ is a table designator. CORZ is used to qualify the first column name in the select list.
  • In SQL naming, an exposed table or view name is a table designator. Thus, OWNY.MYTABLE is a table designator. OWNY.MYTABLE is used to qualify the second column name in the select list.
  • In system naming, the table designator for an exposed table or view name is the unqualified table or view name. In the following example MYTABLE is the table designator for OWNY/MYTABLE.
       SELECT CORZ.COLA, MYTABLE.COLA
         FROM OWNX/MYTABLE CORZ, OWNY/MYTABLE

Two or more object tables can be instances of the same table. In this case, distinct correlation names must be used to unambiguously designate the particular instances of the table. In the following FROM clause, X and Y are defined to refer, respectively, to the first and second instances of the table EMPLOYEE:

  SELECT * FROM EMPLOYEE X,EMPLOYEE Y