SQL Aliases (AS)

An alias gives a column or table a temporary name for one query. Column aliases make results readable. Table aliases keep joins short.

Updated December 1, 2026

Syntax

SELECT column AS alias_name
FROM table_name AS t;

Rename output columns

The alias only changes the result’s heading, not the table.

SELECT name AS drink, price AS usd
FROM drinks;
Result on the SQL Café sample data (10 rows, first 4 shown)
drinkusd
Espresso3
Latte4.5
Cappuccino4.25
Mocha5

Name a calculated column

Without an alias, a calculated column gets a heading like ROUND(price * 0.9, 2). An alias gives it a clear name.

SELECT name, ROUND(price * 0.9, 2) AS member_price
FROM drinks
WHERE category = 'tea';
Result on the SQL Café sample data (3 rows)
namemember_price
Matcha Latte4.73
Chai Latte4.28
Peppermint Tea2.93

Table aliases in joins

Short table aliases like o and c save typing when you need to say which table a column comes from.

SELECT o.id, c.name, o.ordered_on
FROM orders AS o
JOIN customers AS c ON c.id = o.customer_id
ORDER BY o.id;
Result on the SQL Café sample data (10 rows, first 5 shown)
idnameordered_on
1Ava2024-07-01
2Ava2024-07-01
3Ben2024-07-02
4Cara2024-07-02
5Dev2024-07-03

Common mistakes

Practice Aliases (AS) interactively

Write real queries in your browser and get instant feedback in the lesson “Rename and dedupe” (Unit 1). New learners can start free from the first lesson.

Frequently asked questions

Is the AS keyword required?

For columns and tables, AS is optional in most databases: SELECT name drink works. Writing AS is clearer. Oracle doesn’t accept AS before table aliases.

Can I use an alias in ORDER BY?

Yes. ORDER BY runs after SELECT, so ORDER BY member_price works everywhere.

Related SQL tutorials