Monday, October 19, 2015

SQL Aliases

SQL Aliases

SQL aliases are used to give a database table, or a column in a table, a temporary name.
Basically aliases are created to make column names more readable.

SQL Alias Syntax for Columns

SELECT column_name AS alias_name
FROM table_name;

SQL Alias Syntax for Tables

SELECT column_name(s)
FROM table_name AS alias_name;

Example

SELECT CustomerName AS Customer, ContactName AS [Contact Person]
FROM Customers;