-
Question about Database Normalization
Hey, I have a question about database normalization. I am making a database that stores spending expenses. I have two tables, merchant and receipts. For the receipts table, would I add a foreign key called merchant that links the merchant data to it or no would that violate the normalization rules? I have ID(primary key), date, total price, merchant(foreign key).
Thank you
-
I would have Merchant ID followed by the record ID with those 2 fields being the primary key.
you do need the Merchant ID in the receipts table.
-
Like GolferGuy said you will need to add the Merchant ID as a foreign key in the receipts table for both your table to be linked and make sure that the relationship using that forign key is a one to many relationship since a merchant can have several receipt, but a receipt can only belong to one merchant.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|