Last updated

SQL Aliases

Definition: An alias is a temporary name you give a column or table using AS. It makes results clearer and queries shorter.

Example 1 — rename columns in the output

SELECT CustomerName AS Name, Country AS Nation
FROM Customers;

The data is unchanged — only the column headings in the result are renamed.

Example 2 — name a calculated column

Calculations need an alias to get a sensible heading:

SELECT ProductName, Price * 2 AS DoublePrice
FROM Products;

Example 3 — table aliases

Short table aliases save typing, especially with joins (next lesson):

SELECT c.CustomerName, c.City
FROM Customers AS c;

💡 Tip: the word AS is optional in most databases — Price * 2 DoublePrice also works — but writing AS makes your intent obvious.

Try it Yourself
Output

          
Ad · responsive