M
Michael Wong
Hi,
I'm still a newbie in database design (this one is only my third
database). I have some difficulties designing the tables and
relationship for an inventory database.
First, let me explain the business:
The business has several shops (Branch).
The products can be located in these different branches.
The inventory is made separately on the different branches. I need to
keep track of the day the last inventory is made on each branch.
So I came up with these two tables:
Product (ProductId PRIMARY, other fields)
Branch (BranchId, other fields)
Now the difficult part for me is how to design the inventory.
One idea I have is the following tables, but I'm not sure if this is a
correct design:
BranchInventory (ProductId PK, BranchId PK, InventoryDate)
InventoryDetail (InventoryDetailId PK, ProductId FK, BranchId FK, Qty,
Location)
One other design is the following:
BranchInventory (BranchInventoryId PK, ProductId FK, BranchId FK,
InventoryDate)
InventoryDetail (InventoryDetailId PK, BranchInventoryId FK, Qty, Location)
Any suggestion would be very much appreciated.
Thanks
I'm still a newbie in database design (this one is only my third
database). I have some difficulties designing the tables and
relationship for an inventory database.
First, let me explain the business:
The business has several shops (Branch).
The products can be located in these different branches.
The inventory is made separately on the different branches. I need to
keep track of the day the last inventory is made on each branch.
So I came up with these two tables:
Product (ProductId PRIMARY, other fields)
Branch (BranchId, other fields)
Now the difficult part for me is how to design the inventory.
One idea I have is the following tables, but I'm not sure if this is a
correct design:
BranchInventory (ProductId PK, BranchId PK, InventoryDate)
InventoryDetail (InventoryDetailId PK, ProductId FK, BranchId FK, Qty,
Location)
One other design is the following:
BranchInventory (BranchInventoryId PK, ProductId FK, BranchId FK,
InventoryDate)
InventoryDetail (InventoryDetailId PK, BranchInventoryId FK, Qty, Location)
Any suggestion would be very much appreciated.
Thanks