Ok so I don't have code for this as I am unsure of how it would even go. Take this scenario I am working on, a purchase system for, let's say, tires.
I have one table named tStock
and another one for customers named as cOrder
.
tStock
has these columns:
(PK) Tyre_ID
(VARCHAR) Manufacturer
(int) Quantity
while cOrder
has:
(PK) Customer_ID
(varchar) Cust_name
(int) Purchase_quantity
What I hope to achieve is that when I have a form that takes a customer's details and orders of how many tires (s)he wants min of 1 tire max of 4 tires that it will then subtract this amount from the database and update it.
Would I be right in thinking that I would need to have customer_ID
and possibly purchase_quantity
in as a foreign key constraint for it to update?
Also would it need to be joined in someway i.e outer, equijoin, natural?
Any suggestions is greatly appreciated
Best Answer
I would have three tables minimum for a purchasing system. One for customer, one for products, one for orders.
Let me know if you have any question.