seco Posted March 28, 2008 Share Posted March 28, 2008 Hi can i make 2 columns primary key in mysql? or i have to make it using php code by searching? thanks in advance. Link to comment https://forums.phpfreaks.com/topic/98280-can-i-make-2-columns-primary-key/ Share on other sites More sharing options...
aschk Posted March 28, 2008 Share Posted March 28, 2008 Yes, now would you like to know how? in a table creation statement: CREATE TABLE mytable ( col1 INT UNSIGNED NOT NULL, col2 INT UNSIGNED NOT NULL, PRIMARY KEY (col1,col2) ) or after table creation ALTER TABLE mytable ADD PRIMARY KEY (col1,col2) Link to comment https://forums.phpfreaks.com/topic/98280-can-i-make-2-columns-primary-key/#findComment-502979 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.