• Some users have recently had their accounts hijacked. It seems that the now defunct EVGA forums might have compromised your password there and seems many are using the same PW here. We would suggest you UPDATE YOUR PASSWORD and TURN ON 2FA for your account here to further secure it. None of the compromised accounts had 2FA turned on.
    Once you have enabled 2FA, your account will be updated soon to show a badge, letting other members know that you use 2FA to protect your account. This should be beneficial for everyone that uses FSFT.

chain supermarket inventory ERD

syn3rgyz

Gawd
Joined
Jun 14, 2005
Messages
763
I'm trying to create an ERD for a supermarket chain and I got stuck after creating the products and store table. under products I have ProdID as the primary key and under store I have storeID as the primary key. My problem is how would I differentiate the different products at each store? If I added an inventory table what would be the primary key for that?
 
You need another table to link the other two tables together, also you may want to include some additional attributes in the column such as price (I guarantee there will be variations from store to store) and stock level.

Plus there is the multiple levels/ type of discounts - have fun!
 
I was going to link the two tables together with the inventory table which has both storeid and productid, but then none of them would be unique to be used as a primary key for the inventory table, isnt that a problem?
 
Then you have solved it already.

No it isn't a problem as long as you have unique indexes in a given table. This can be by using a surrogate key (unique but doesn't really mean anything) or use compound keys which are a combination of other (typically foreign) keys.
 
Back
Top