Order table
This commit is contained in:
parent
29b68d05e0
commit
0445d0f795
1 changed files with 15 additions and 0 deletions
15
README.md
15
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.
|
> 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'.
|
So, our pallet table needs a status column. This conveniently fits as an enum of 'freezer', 'delivered' and 'blocked'.
|
||||||
|
|
Loading…
Reference in a new issue