Table
order_line
Products and quantities in an order, with the price charged.
Replaces in 2020: Invoices
Rows 1,001–1,025 of 5,412
| order_id→ purchase_order.order_id | product_id→ product.product_id | quantityINTEGER | unit_price_centsINTEGER |
|---|---|---|---|
| 1001 | 1 | 1 | 1500 |
| 1002 | 2 | 3 | 1700 |
| 1003 | 3 | 1 | 800 |
| 1004 | 2 | 5 | 1700 |
| 1005 | 1 | 1 | 1500 |
| 1006 | 1 | 1 | 1500 |
| 1007 | 2 | 3 | 1700 |
| 1008 | 2 | 4 | 1700 |
| 1009 | 3 | 1 | 800 |
| 1010 | 3 | 1 | 800 |
| 1011 | 2 | 4 | 1700 |
| 1012 | 1 | 3 | 1500 |
| 1013 | 1 | 2 | 1500 |
| 1014 | 2 | 1 | 1700 |
| 1015 | 2 | 1 | 1700 |
| 1016 | 4 | 1 | 400 |
| 1017 | 4 | 1 | 400 |
| 1018 | 4 | 1 | 400 |
| 1019 | 2 | 4 | 1700 |
| 1020 | 4 | 1 | 400 |
| 1021 | 2 | 1 | 1700 |
| 1022 | 3 | 1 | 800 |
| 1023 | 3 | 1 | 800 |
| 1024 | 4 | 1 | 400 |
| 1025 | 2 | 5 | 1700 |
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;