When a query uses more than one table, identify a column with its table and column names: table.column. This prevents confusion when tables share a column name. section 8.2.1
Joining an order to its customer
SELECT orderheader.CustomerID, customer.FirstName, customer.LastName FROM orderheader JOIN customer ON orderheader.CustomerID = customer.CustomerID WHERE orderheader.OrderID = 1001; section 8.2.1
Here, orderheader.CustomerID and customer.CustomerID tell the database exactly which CustomerID to compare. Writing only CustomerID would be ambiguous because both tables contain that column. Two-part names also make a query easier to read and organize. section 8.2.1
SELECT
orderheader.CustomerID,
customer.FirstName,
customer.LastName
FROM orderheader
JOIN customer
ON orderheader.CustomerID = customer.CustomerID
WHERE orderheader.OrderID = 1001;
Inspect the complete join query and see qualified names used in SELECT, ON, and WHERE clauses. section 8.2.1
