Using Table Aliases
The readability of a SELECT statement can be improved by giving a table an alias, also known as a correlation name or range variable. A table alias can be assigned either with or without the AS keyword:
table_name AS table alias
In the following example, the alias c is assigned to Customer and the alias s is assigned to Store.
USE AdventureWorks2008R2; GO SELECT c.CustomerID, s.Name FROM Sales.Customer AS c JOIN Sales.Store AS s ON c.CustomerID = s.BusinessEntityID ;
If an alias is assigned to a table, all explicit references to the table in the Transact-SQL statement must use the alias, not the table name. For example, the following SELECT generates a syntax error because it uses the name of the table when an alias has been assigned:
SELECT Sales.Customer.CustomerID, /* Illegal reference to Sales.Customer. */ s.Name FROM Sales.Customer AS c JOIN Sales.Store AS s ON c.CustomerID = s.BusinessEntityID ;