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.


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


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.

FROM tbl_Customers AS C

Did you find the page informational and useful? Share it using one of your favorite social sites.

Recommended Books & Training Resources

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