Joining two tables
The products table only stores a supplier_id. The supplier's name lives in suppliers. A join
puts the two together, matching each product to its supplier:
SELECT products.name, suppliers.name
FROM products
JOIN suppliers ON suppliers.id = products.supplier_idON says how the rows match: here, the supplier whose id equals the product's supplier_id. The
schema panel shows these links with an arrow (→).
JOIN on its own means INNER JOIN: only rows that find a match are kept. A product with no
supplier recorded drops out. (The next module is about keeping them.)
When two tables share a column name, like name here, say which table you mean.