2. Introducing SQL : Correlation Names
 
Share this page                  
Correlation Names
Correlation names are used in queries to clarify the table (or view) to which a column belongs or to abbreviate long table names. For example, the following query uses correlation names to join a table with itself:
SELECT a.empname FROM emp a, emp b
     WHERE a.mgrname = b.empname
     AND a.salary > b.salary;
Correlation names can also allow the schema name and table to be clarified for all columns used in queries. For example, the following query uses correlation names to join a table with the same name between schemas:
SELECT m.empname FROM my.emp m, your.emp y
     WHERE m.mgrname = y.empname
     AND m.salary > y.salary;