Reputation: 1279
I am getting a little stuck with the inventory table design and would appreciate if anyone could guide me with that.
The inventory is at 3 different locations(warehouses). I want help with how do I avoid creating multiple itemcodes for each warehouse
The current set up is as follows: -
inventory_T
item_costs
stock_balance
Upvotes: 0
Views: 15278
Reputation: 26861
I suppose you have a single database which serves all warehouses.
Create another table
warehouses
And then add the field - warehouseid to table stock_balance as a FK(Foreign Key) - this way you will bind each stock of an item to a warehouse
Upvotes: 0
Reputation: 6157
First of all, you need to describe your problem:
How can I store the information about items so that I know how many are at each location?
The three things in bold are the key pieces of information. Which means, we need to be able to keep track of locations and items and everything that can be different for a given location. Everything else about the items we store in the items table. Everything else about the location we store in the locations table. The above problem description says only the amount stored is different, but it can be for your problem that other things about the items are different, modify as needed.
I would go as follows:
Note: Item ID and Warehouse ID combined is the primary key.
Upvotes: 1