Field name qualifiers to avoid ambiguity
In the context of an ORDER BY clause, an expression, or a search condition, a field name refers to values of a field in some segment or view in a DELETE or UPDATE statement or table-reference in a FROM clause.
One reason for qualifying a field name is to designate the object from which the field comes.
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 statement are named in the FROM clause that follows it, as in the following statement:
SELECT Z.HOSPCODE, WARDNO, WARDLL
FROM PCB01.HOSPITAL Z, PCB01.WARD
WHERE Z.HOSPNAME = 'ALEXANDRIA'
AND Z.HOSPCODE = 'R1210010000A'
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, Z is a table designator and qualifies the first column name in the select list.
- An exposed table or view name is a table designator. Thus, the qualified table name, PCB01.WARD is a table designator and qualifies the second column name in the select list.