suresh_kamrushi Posted June 2, 2011 Share Posted June 2, 2011 what is the difference between Primary Key and Index Key in MySql ? Link to comment https://forums.phpfreaks.com/topic/238176-primary-key-and-unique-key-difference/ Share on other sites More sharing options...
teynon Posted June 2, 2011 Share Posted June 2, 2011 From my understanding of it, primary key is basically the same only that it is the absolute key (identifying rows in the table). Unique key would mean that each key has to be different or it would result in an error. I am not super positive though, I as I have never needed anything besides the primary key. I suppose it would be useful if you want a table with an id that could be linked to another table id, but only one time. Link to comment https://forums.phpfreaks.com/topic/238176-primary-key-and-unique-key-difference/#findComment-1224242 Share on other sites More sharing options...
fenway Posted June 2, 2011 Share Posted June 2, 2011 @teynon: If you never needed anything but the PK, you're not indexing correctly. PK is just a special version of unique key --- very special. Link to comment https://forums.phpfreaks.com/topic/238176-primary-key-and-unique-key-difference/#findComment-1224405 Share on other sites More sharing options...
teynon Posted June 4, 2011 Share Posted June 4, 2011 How should I be indexing then? Link to comment https://forums.phpfreaks.com/topic/238176-primary-key-and-unique-key-difference/#findComment-1225194 Share on other sites More sharing options...
fenway Posted June 27, 2011 Share Posted June 27, 2011 How should I be indexing then? Sorry about the delayed response -- I don't understand the question. Link to comment https://forums.phpfreaks.com/topic/238176-primary-key-and-unique-key-difference/#findComment-1235279 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.