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.
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