liveBook · Manning

On clause

As explained in Learn SQL in a Month of Lunches

ON is an SQL keyword that introduces the predicate defining how rows from joined sources are related.

The ON clause tells SQL how rows from joined tables relate. For example, an order stores a CustomerID, and the customer table stores the matching CustomerID. JOIN names the extra table; ON states the matching condition. section 8.2.1

SELECT
    orderheader.CustomerID,
    customer.FirstName,
    customer.LastName
FROM orderheader
JOIN customer
    ON orderheader.CustomerID = customer.CustomerID
WHERE orderheader.OrderID = 1001;

This query joins orderheader to customer through their shared CustomerID, then returns the first order’s customer name. section 8.2.1

How Learn SQL in a Month of Lunches covers it

How deep it goes
Explains ON through a complete query and compares its role with WHERE and AND, without descending into database internals.
Examples
Uses orderheader and customer tables joined on CustomerID to retrieve the first order’s customer details.
What it assumes
Assumes basic SELECT, FROM, and WHERE usage while teaching table relationships through an order-and-customer task.
What you can do after
Apply it via SQL to combine related table data and return fields from both sources.
How it connects
Relates ON to JOIN, the FROM clause, WHERE filtering, and AND conditions.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Learn SQL in a Month of Lunches. The section links point to the parts of the book it draws on.