> I would like to have a table that has a primary key defined on a
> combination of two columns in the table.  In other words a unique key
> based upon the values in two columns.
> 
> I don't think I am able to do this in mysql.  I think you can only have
> a primary key on one column and not on a combination of columns.  If I
> am wrong please correct me.

You're wrong :-)

mysql> CREATE TABLE tablename (col_a int not null, 
    -> b int not null, PRIMARY KEY (a, b));

> I am looking for work arounds.

No need to...

/ Carsten
--
Carsten H. Pedersen
keeper and maintainer of the bitbybit.dk MySQL FAQ
http://www.bitbybit.dk/mysqlfaq




---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to