Table
order_line
Products and quantities in an order, with the price charged.
Replaces in 2020: Invoices
Rows 3,001–3,025 of 5,412
| order_id→ purchase_order.order_id | product_id→ product.product_id | quantityINTEGER | unit_price_centsINTEGER |
|---|---|---|---|
| 3001 | 1 | 1 | 1500 |
| 3002 | 2 | 1 | 1700 |
| 3003 | 1 | 2 | 1500 |
| 3004 | 1 | 1 | 1500 |
| 3005 | 3 | 1 | 800 |
| 3006 | 3 | 1 | 800 |
| 3007 | 3 | 1 | 800 |
| 3008 | 2 | 4 | 1700 |
| 3009 | 1 | 1 | 1500 |
| 3010 | 2 | 2 | 1700 |
| 3011 | 2 | 2 | 1700 |
| 3012 | 3 | 1 | 800 |
| 3013 | 3 | 1 | 800 |
| 3014 | 1 | 1 | 1500 |
| 3015 | 1 | 1 | 1500 |
| 3016 | 1 | 2 | 1500 |
| 3017 | 4 | 1 | 400 |
| 3018 | 2 | 5 | 1700 |
| 3019 | 3 | 1 | 800 |
| 3020 | 3 | 1 | 800 |
| 3021 | 1 | 1 | 1500 |
| 3022 | 2 | 1 | 1700 |
| 3023 | 1 | 2 | 1500 |
| 3024 | 1 | 3 | 1500 |
| 3025 | 4 | 1 | 400 |
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;