Jump to content

Alias (SQL)

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Shukla.rohit09 (talk | contribs) at 12:07, 19 September 2011. The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

You can give an another name to a table by using an alias.

This can be a good thing to do if you have very long or complex table names.

Note: An alias name could be anything, but usually it is short.


Syntax: SELECT * FROM table_name AS alias_name

For Example:

Department Table
DepartmentID DepartmentName
31 Sales
33 Engineering
34 Clerical
35 Marketing




SELECT D.DepartmentName FROM Department AS D

Note: We can also write like this SELECT D.DepartmentName FROM Department D