Did you find this useful?
Socialize it today.


Assigning an Alias to Columns and Tables

Thursday, November 17, 2011

tags SQL

SQL allows you to assign an alias name to a column or a table.

Syntax


SELECT column_name AS alias_name
FROM table_name
SELECT column_name(s)
FROM table_name
AS alias_name


Examples


Assign the alias of "Customer Name" to the column "custName.


SELECT custName AS [Customer Name] 
FROM Customers


Assign the alias of "C" to the table called "tbl_Customers". This allows you to reference the table as "C" instead of the longer, original name.


SELECT * 
FROM tbl_Customers AS C

Please help us spread the word by socializing it today!

email contact us

Did you find something wrong with the information on this page? Please take a moment to report it to us so that we can continue to improve the quality of the information on this site. Click here to report an issue with this page.



Recommended Books & Training Resources

SQL Cookbook Head First SQL: Your Brain on SQL A Learners Guide