View Full Version : normalisation with foreign keys
07-29-2006, 09:39 PM
Can a table have a more than one foreign key from more than one table stored in another table? Ie. can a repair table contain a foreign key from the mechanic table (for the mechanic that did the job) and another foreign key from the Customer table (to specify who the repair is to be charged to)?? Also would this mean the table is still normalised??
07-29-2006, 10:42 PM
re reading my question it may seem a little vague. The table structure below is tblJob, in I have marked the fields which are foreign keys.
I have simply one question:
1. Is there a limit to the amount of foreign keys you can have in the one table all of which are key fields in their own individual table, and will this affect normailisation???
JobID (Primary Key)
MechID (Foreign Key)
Auth By (Foreign Key)
Customer ID (Foreign Key)
Registration ID (Foreign Key)
Lab ID (Foreign Key)
Part ID (Foreign Key)
Vat ID (Foreign Key)
07-30-2006, 12:55 AM
no problem having that many foreign keys in your tables. you might want to show the layouts from your tables so we can tell you whether or not your tables are properly normalized, or, if not, offer suggestions to fix them.
07-30-2006, 07:53 PM
ok here goes...... below is the table architecture you requested, also plz note further questions below the list of tables!!
1.Could someone please tell me if these tables are normalised and if not could they show me what I have done wrong???
2.The reason I asked in my previous post if the table 'tblJob' was normalised was because of the number of foreign keys, but I was wondering if it would be better to split the Job Table into two and have the JobID as the primary key in tblJob and create a table 'tblJobDetails' which would store all the foreign keys that are in the current table, 'tblJob'??? Would it be better to leave the table tblJob in its current state (the way it is listed above) , or should I change it to the way I have just mentioned, by splitting it into two separate tables???
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.