Table
order_line
Products and quantities in an order, with the price charged.
Replaces in 2020: Invoices
Rows 5,001–5,025 of 5,412
| order_id→ purchase_order.order_id | product_id→ product.product_id | quantityINTEGER | unit_price_centsINTEGER |
|---|---|---|---|
| 5001 | 1 | 5 | 1500 |
| 5002 | 1 | 2 | 1500 |
| 5003 | 1 | 2 | 1500 |
| 5004 | 2 | 1 | 1700 |
| 5005 | 1 | 2 | 1500 |
| 5006 | 2 | 1 | 1700 |
| 5007 | 3 | 1 | 800 |
| 5008 | 4 | 1 | 400 |
| 5009 | 1 | 2 | 1500 |
| 5010 | 1 | 1 | 1500 |
| 5011 | 2 | 2 | 1700 |
| 5012 | 2 | 4 | 1700 |
| 5013 | 2 | 2 | 1700 |
| 5014 | 3 | 1 | 800 |
| 5015 | 4 | 1 | 400 |
| 5016 | 4 | 1 | 400 |
| 5017 | 1 | 2 | 1500 |
| 5018 | 1 | 1 | 1500 |
| 5019 | 4 | 1 | 400 |
| 5020 | 1 | 2 | 1500 |
| 5021 | 2 | 1 | 1700 |
| 5022 | 1 | 2 | 1500 |
| 5023 | 1 | 1 | 1500 |
| 5024 | 1 | 2 | 1500 |
| 5025 | 1 | 2 | 1500 |
Table definition
CREATE TABLE order_line (
order_id INTEGER NOT NULL REFERENCES purchase_order (order_id),
product_id INTEGER NOT NULL REFERENCES product (product_id),
quantity INTEGER NOT NULL CHECK (quantity > 0),
unit_price_cents INTEGER NOT NULL CHECK (unit_price_cents >= 0),
PRIMARY KEY (order_id, product_id)
) STRICT;