skip to today's puzzle

A table alias is a short name for a table

A table alias is a short nickname for a table, written right after its name in FROM or JOIN. When a query uses more than one table, you put the table name in front of each column to say where it comes from — the alias keeps that short: c.name instead of customers.name.

A tiny example

In plain English: Show me each customer’s name next to the total of their order.

SELECT c.name, o.total
FROM customers c
JOIN orders o
  ON o.customer_id = c.id;

Query result

nametotal
Amara8.5
Theo12

The name came from customers (c) and the total from orders (o) — the aliases say which table each column is from.

Common questions

Do I need the AS keyword for a table alias?
No. FROM orders o and FROM orders AS o mean the same thing. Most teams skip AS for tables, but keep it for column aliases because it reads clearer.
Why alias tables in a JOIN?
It keeps long table names from cluttering every column reference: o.customer_id = c.id is much easier to scan than orders.customer_id = customers.id, especially in big queries.

Related SQL lessons

Practice table aliases step by step

The Foundations Track has beginner puzzles built around this idea. Tap tiles, see real results. No terminal, no setup.

practice this in the course

Ready for a break?

A fresh, bite-sized SQL puzzle waits every morning. Tap tiles, see real results. No terminal, no setup, no timers.

Try today's free SQL puzzle