Beginner

494. JOIN Alias

Learn how table aliases make JOIN queries shorter, clearer, and easier to manage.

📘 Lesson 494 of 728 ⏱ 10 min 🎯 Beginner

A table alias is a temporary name assigned to a table within a SQL query. Aliases are especially useful when multiple tables contain columns with the same names.

Aliases improve readability and prevent ambiguity when working with multiple tables.

Use c for Customers and o for Orders to make a JOIN query easier to read.

SQL
SELECT
    c.CustomerName,
    o.OrderID,
    o.OrderAmount
FROM Customers c
INNER JOIN Orders o
    ON c.CustomerID = o.CustomerID;

Aliases are used in almost every practical multi-table SQL query.

  • Aliases provide shorter table names.
  • Aliases improve query readability.
  • They help avoid ambiguous column references.
  • Aliases are especially useful with multiple JOINs.
  • Aliases exist only within the query.
Why are aliases used in JOINs?

Aliases make queries shorter and help clearly identify which table each column belongs to.

Can the same alias be used for two tables?

No. Each table reference in the query must have an unambiguous alias.

Have you finished this lesson?

Introduction to SQL – All Lessons