Table
order_line
Products and quantities in an order, with the price charged.
Replaces in 2020: Invoices
Rows 1,801–1,825 of 5,412
| order_id→ purchase_order.order_id | product_id→ product.product_id | quantityINTEGER | unit_price_centsINTEGER |
|---|---|---|---|
| 1801 | 3 | 1 | 800 |
| 1802 | 3 | 1 | 800 |
| 1803 | 3 | 1 | 800 |
| 1804 | 2 | 3 | 1700 |
| 1805 | 2 | 1 | 1700 |
| 1806 | 2 | 2 | 1700 |
| 1807 | 3 | 1 | 800 |
| 1808 | 3 | 1 | 800 |
| 1809 | 4 | 1 | 400 |
| 1810 | 2 | 1 | 1700 |
| 1811 | 2 | 2 | 1700 |
| 1812 | 1 | 2 | 1500 |
| 1813 | 2 | 1 | 1700 |
| 1814 | 3 | 1 | 800 |
| 1815 | 1 | 2 | 1500 |
| 1816 | 3 | 1 | 800 |
| 1817 | 3 | 1 | 800 |
| 1818 | 1 | 1 | 1500 |
| 1819 | 4 | 1 | 400 |
| 1820 | 2 | 2 | 1700 |
| 1821 | 3 | 1 | 800 |
| 1822 | 1 | 5 | 1500 |
| 1823 | 1 | 2 | 1500 |
| 1824 | 2 | 1 | 1700 |
| 1825 | 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;