[thelist] mysql primary key multiple columns

rudy limeback r937 at interlog.com
Tue Aug 29 08:54:18 CDT 2000


>Can I set multiple columns as primary key in mysql so that it is the 
>COMBINATION that is unique?

hi peter

according to the manual, yes, you can

  "A PRIMARY KEY can be a multiple-column index. However, you 
   cannot create a multiple-column index using the PRIMARY KEY 
   key attibute in a column specification. Doing so will mark only that 
   single column as primary. You must use the PRIMARY KEY
   (index_col_name, ...) syntax."
  http://mysql.com/Manual_chapter/manual_Reference.html#CREATE_TABLE


rudy
r937.com







More information about the thelist mailing list