Log in

View Full Version : Solved: Setting primary keys



majaro
01-04-2008, 01:31 PM
I have approximatly 20 tables that I need to do queries on. The problem is there are no common fields. How would you go about selecting a PK?

:dunno

tmptplayer
01-05-2008, 10:56 AM
All a primary key needs to be is a unique identifier for each record. Your key should be picked for each table independent of the other tables. If you want other tables to reference eachother's primary keys, then you need to take care of that in your table construction.

With respect to your other 20 tables, you're going to have to find a way to relate them, and the relationships may or may not go through your primary key. If they share no common fields, how do you expect to query the tables together? How do you as a person draw the relationship between the tables, and maybe you can use your own logic to modify the structure to make it useable.