If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > What must foreign key reference?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-09-06, 03:04
vk101 vk101 is offline
Registered User
 
Join Date: Mar 2006
Posts: 43
What must foreign key reference?

I read something that made it seem as though InnoDB foreign keys can reference anything: primary keys, unique keys, and even non-unique columns...have I interpreted this correctly?

What do MySQL's other storage engines like MyISAM allow for what foreign keys can reference? Can they reference anything, or just primary keys, or primary keys as well as unique keys?

Thanks.
Reply With Quote
  #2 (permalink)  
Old 11-09-06, 04:10
healdem healdem is online now
Jaded Developer
 
Join Date: Nov 2004
Location: out on a limb
Posts: 9,259
Foreign Keys defintions dont do anythingwork when using MyISAM
see the MySQL site for further details, and even then it depends on what version of MySQL you are using.

a Foreign Key constraint can only work on the referred (the "parent") table being unique keys which usually are also the primary key int he referred table.
__________________
I'd rather be riding my Versys or my Tiger 800 let alone the Norton
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On