Multi-table SELECT Statements
Go Up to Listing Columns to Retrieve with SELECT
When data is retrieved from multiple tables, views, and select procedures, the same column name may appear in more than one table. In these cases, the SELECT
statement must contain enough information to distinguish like-named columns from one another.
To distinguish column names in multiple tables, precede those columns with one of the following qualifiers in the SELECT
clause:
- The name of the table, followed by a period. For example,
EMPLOYEE
.EMP_NO
identifies a column namedEMP_NO
in theEMPLOYEE
table. - A table correlation name (alias) followed by a period. For example, if the correlation name for the
EMPLOYEE
table isEMP
, thenEMP.EMP_NO
identifies a column namedEMP_NO
in theEMPLOYEES
table.
Correlation names can be declared for tables, views, and select procedures in the FROM
clause of the SELECT
statement. For more information about declaring correlation names, and for examples of their use, see Declaring and Using Correlation Names.