I have a table called order
and it stores what a customer needed for their order.
The table consists of (It is simplified):
orderID, stockID, quantity, custID, handledBy and status.
The composite primary key of this table is orderID and stockID.
How do I ensure that certain fields have the same data when inserting new records?
For example:
I want to add these records:
(order001, stock001, 15, cust001, staff001, Packing)
(order001, stock002, 50, cust001, staff001, Ready to Deliver)
How do I ensure that the custID and the staffID fields have the same data so that the below possible scenario will not happen?
(order001, stock001, 15, cust001, staff001, Packing)
(order001, stock002, 50, cust005, staff001, Ready to Deliver)