...

View Full Version : Multiple primary keys question



TAViX
02-27-2009, 07:05 AM
I have a database with 7 tables. I have one ...main table which contains mostly the primary keys from the other tables. BUT, beeing a primary table, meaning that I need to add the data first in that primary table, then I need to read that data from other tables. My question is:
Do I need to make all the keys in the main table as primary keys, then make those keys foreign keys in the other tables, or what would be the best aproach?

abduraooft
02-27-2009, 07:15 AM
BUT, beeing a primary table, meaning that I need to add the data first in that primary table, then I need to read that data from other tables. Looks like your tables are not normalised and not getting any advantage of primary keys. Could you post your table schema?

oesxyl
02-27-2009, 07:21 AM
I have a database with 7 tables. I have one ...main table which contains mostly the primary keys from the other tables. BUT, beeing a primary table, meaning that I need to add the data first in that primary table, then I need to read that data from other tables. My question is:
Do I need to make all the keys in the main table as primary keys, then make those keys foreign keys in the other tables, or what would be the best aproach?
this depend of your data model. Each table must refere to a single entity and each pair primary keys, foreign key must describe a relation between them.

best regards



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum