vijdev Posted May 5, 2010 Share Posted May 5, 2010 Is it mandatory for a referenced or referencing field to be a primary key, or any index would do? Are there any dangers if they are not primary keys? (Am obvly using INNODB.) Quote Link to comment https://forums.phpfreaks.com/topic/200776-foreign-keys-question/ Share on other sites More sharing options...
Mchl Posted May 5, 2010 Share Posted May 5, 2010 I think referenced has to be UNIQUE, referencing can by any INDEX. In other words, it has to be a one-to-many relation. Quote Link to comment https://forums.phpfreaks.com/topic/200776-foreign-keys-question/#findComment-1053532 Share on other sites More sharing options...
vijdev Posted May 6, 2010 Author Share Posted May 6, 2010 yes it must be...else no logical sense..i experimented with some data as well.. well, this is my understanding for now...and if more ppl wana pour in..please do.thanks! Quote Link to comment https://forums.phpfreaks.com/topic/200776-foreign-keys-question/#findComment-1053940 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.