diff --git a/README.md b/README.md index a449f82..aa1250c 100644 --- a/README.md +++ b/README.md @@ -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 doesn’t 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'.