Table
order_line
Products and quantities in an order, with the price charged.
Replaces in 2020: Invoices
Rows 4,201–4,225 of 5,412
| order_id→ purchase_order.order_id | product_id→ product.product_id | quantityINTEGER | unit_price_centsINTEGER |
|---|---|---|---|
| 4201 | 1 | 2 | 1500 |
| 4202 | 4 | 1 | 400 |
| 4203 | 1 | 2 | 1500 |
| 4204 | 3 | 1 | 800 |
| 4205 | 4 | 1 | 400 |
| 4206 | 3 | 1 | 800 |
| 4207 | 1 | 1 | 1500 |
| 4208 | 4 | 1 | 400 |
| 4209 | 1 | 2 | 1500 |
| 4210 | 4 | 1 | 400 |
| 4211 | 1 | 1 | 1500 |
| 4212 | 1 | 4 | 1500 |
| 4213 | 4 | 1 | 400 |
| 4214 | 1 | 1 | 1500 |
| 4215 | 2 | 1 | 1700 |
| 4216 | 4 | 1 | 400 |
| 4217 | 1 | 4 | 1500 |
| 4218 | 4 | 1 | 400 |
| 4219 | 1 | 50 | 1500 |
| 4220 | 1 | 1 | 1500 |
| 4221 | 2 | 2 | 1700 |
| 4222 | 1 | 4 | 1500 |
| 4223 | 3 | 1 | 800 |
| 4224 | 4 | 1 | 400 |
| 4225 | 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;