Order table

This commit is contained in:
Imbus 2024-05-04 13:21:44 +02:00
parent 29b68d05e0
commit 0445d0f795

View file

@ -97,6 +97,21 @@ CREATE TABLE deliveries (
);
```
> Orders must be registered in the database, and, for production planning purposes, the company must be able to see all orders which are to be delivered during a specific time period.
Note that the individial pallets hold the delivery date.
```sql
CREATE TABLE orders (
order_id INT PRIMARY KEY,
customer_id INT NOT NULL,
cookie_id INT NOT NULL,
order_date DATE NOT NULL DEFAULT CURRENT_DATE CHECK (order_date >= CURRENT_DATE),
FOREIGN KEY (customer_id) REFERENCES customer(customer_id),
FOREIGN KEY (cookie_id) REFERENCES cookie(cookie_id)
);
```
> The company continuously take random samples among the products, and the samples are analyzed in their laboratory. If a sample doesnt meet their quality standards, all pallets containing that product which have been produced during a specific time interval are blocked. A blocked pallet may not be delivered to customers.
So, our pallet table needs a status column. This conveniently fits as an enum of 'freezer', 'delivered' and 'blocked'.