yandoo Posted February 8, 2008 Share Posted February 8, 2008 Hi there, just wanted to know if its ok to have multiple primary keys of different tables (int's) all with auto increment feature?? Is this ok to do or am i like to run into problems if i go down this path?? Thanks Smiley Link to comment https://forums.phpfreaks.com/topic/89983-solved-auto-increment-on-multiple-primary-keys-from-different-tables-innodb/ Share on other sites More sharing options...
Barand Posted February 8, 2008 Share Posted February 8, 2008 A table can have ONE primary key A table can have ONE auto_increment column which must be defined as a key (so it is normally the PK) Each table should have a primary key. If you want to make each table's PK an auto_inc column then that's fine. Link to comment https://forums.phpfreaks.com/topic/89983-solved-auto-increment-on-multiple-primary-keys-from-different-tables-innodb/#findComment-461363 Share on other sites More sharing options...
yandoo Posted February 8, 2008 Author Share Posted February 8, 2008 Brilliant thanks! I was worried that interactions of different records from different tables with auto number Primary keys may some how get confussed... I know this probably seems like a silly question but is there some way i could have a auto incremented code?? Like Product1, Product2, etc.) as primary key of a table??? Only auto increment in phpmyadmin only works with INT...not VARCHAR.. Thanks Link to comment https://forums.phpfreaks.com/topic/89983-solved-auto-increment-on-multiple-primary-keys-from-different-tables-innodb/#findComment-461385 Share on other sites More sharing options...
Barand Posted February 8, 2008 Share Posted February 8, 2008 auto_inc must be numeric - TINYINT, SMALLINT, INT Link to comment https://forums.phpfreaks.com/topic/89983-solved-auto-increment-on-multiple-primary-keys-from-different-tables-innodb/#findComment-461390 Share on other sites More sharing options...
yandoo Posted February 8, 2008 Author Share Posted February 8, 2008 Cool, Thanks Link to comment https://forums.phpfreaks.com/topic/89983-solved-auto-increment-on-multiple-primary-keys-from-different-tables-innodb/#findComment-461394 Share on other sites More sharing options...
Aureole Posted February 8, 2008 Share Posted February 8, 2008 auto_inc must be numeric - TINYINT, SMALLINT, INT What about MEDIUMINT? Link to comment https://forums.phpfreaks.com/topic/89983-solved-auto-increment-on-multiple-primary-keys-from-different-tables-innodb/#findComment-461420 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.