Blog · Guide

JOIN order_items to products (Line Items Explained)

Order lines point at products by id. Here’s how that JOIN turns a receipt into readable product names.

orders order_id customer_id ← status JOIN customers → customer_id first_name city row
A JOIN stitches tables together using a shared key (here: customer_id).

The receipt pattern

order_items stores product_id and qty. Names and prices live on products. Join them to see what was sold:

SELECT p.name, oi.qty
FROM order_items oi
JOIN products p ON oi.product_id = p.product_id;

Try it yourself

The fastest way to lock this in is a short drill on the same Northstar Market tables.

Practice order_items → products

Related guides