Table
order_line
Products and quantities in an order, with the price charged.
Replaces in 2020: Invoices
Rows 101–125 of 5,412
| order_id→ purchase_order.order_id | product_id→ product.product_id | quantityINTEGER | unit_price_centsINTEGER |
|---|---|---|---|
| 101 | 3 | 1 | 800 |
| 102 | 4 | 1 | 400 |
| 103 | 2 | 5 | 1700 |
| 104 | 1 | 2 | 1500 |
| 105 | 2 | 1 | 1700 |
| 106 | 1 | 1 | 1500 |
| 107 | 4 | 1 | 400 |
| 108 | 2 | 2 | 1700 |
| 109 | 2 | 2 | 1700 |
| 110 | 3 | 1 | 800 |
| 111 | 3 | 1 | 800 |
| 112 | 1 | 2 | 1500 |
| 113 | 4 | 1 | 400 |
| 114 | 4 | 1 | 400 |
| 115 | 1 | 4 | 1500 |
| 116 | 3 | 1 | 800 |
| 117 | 3 | 1 | 800 |
| 118 | 1 | 1 | 1500 |
| 119 | 1 | 1 | 1500 |
| 120 | 2 | 2 | 1700 |
| 121 | 3 | 1 | 800 |
| 122 | 3 | 1 | 800 |
| 123 | 2 | 1 | 1700 |
| 124 | 2 | 4 | 1700 |
| 125 | 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;