Skip to content

6.3 — Multi-Table Joins

What You'll Learn

  • How to join three or more tables in SQL
  • How this compares to using multiple VLOOKUPs in Excel
  • Syntax and best practices

Sample Tables

Table sales:

SaleIDProductIDCustomerIDAmount
11011001120
2102100280
3103100350

Table products:

ProductIDProductName
101Apples
102Oranges
103Bananas

Table customers:

CustomerIDCustomerName
1001John Smith
1002Jane Doe
1003Mike Johnson

Joining Multiple Tables

In Excel, you might use several VLOOKUPs to bring in data from different sheets. In SQL, you can join as many tables as you need.

Example: Join sales, products, and customers

sql
SELECT s.SaleID, s.Amount, p.ProductName, c.CustomerName
FROM sales s
INNER JOIN products p
  ON s.ProductID = p.ProductID
INNER JOIN customers c
  ON s.CustomerID = c.CustomerID;
  • Each JOIN adds another table to your results.
  • Use table aliases (s, p, c) for readability.

Key Points

  • You can join as many tables as needed, as long as you define the relationships.
  • Use clear aliases to keep queries readable.

Next Steps

Next, you’ll learn how to migrate your Excel workflows to SQL for more efficient, scalable analysis.