foreign key

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
sebs
Forum Commoner
Posts: 97
Joined: Tue Sep 20, 2005 10:13 am

foreign key

Post by sebs »

I have ID in table1 and IDm in table2,ID is primary key in it's table.Is there anyway I can make a relation between those 2 keys so the compare between them works faster(foreign key or...)?
Last edited by sebs on Fri Nov 04, 2005 9:19 am, edited 1 time in total.
prima-nocte
Forum Newbie
Posts: 9
Joined: Tue Oct 04, 2005 7:28 am

Post by prima-nocte »

sebs
Forum Commoner
Posts: 97
Joined: Tue Sep 20, 2005 10:13 am

Post by sebs »

i WILL use join but for the join to work faster?IDm is not primary key.Instead of making a index on ID and IDm can I write something like IDm has foreign key ID?
prima-nocte
Forum Newbie
Posts: 9
Joined: Tue Oct 04, 2005 7:28 am

Post by prima-nocte »

not to my knowledge.. I would use the index on them and put them together with the JOIN.. (and if my english was any better i could explain why ;) )
Post Reply