BTW Carlos, I'm not sure why you would want or need two primary keys in a table, but if find you truly do (as opposed to a PK and some other unique index/key) - there is probably something wrong with your database design. You may need to rethink your design. Do some research and reading on the topics of "Database Design" and "Database Normalization" - that may help.
I know when I first started in Databases (especially in designing them), I had some major misconceptions as to what a PK was and how it should be used. The O'Reilly's book "Managing and Using MySQL, 2nd Edition" has a good chapter on the topics. So does "Mastering MySQL 4". But keep in mind these are only *basic* tutorials and high-level coverage of the subject. Also cheek out Paul DuBois' book "MySQL, 2nd Edition". While, if my memory serves me correctly, he does not have a specific chapter on DB design or normalization, he does teach good design concepts as you progress through the book and its examples; and for anything else MySQL related, it is, IMHO, the best book out there. Good luck, Mark --- Mark V <[EMAIL PROTECTED]> wrote: > Hi Carlos, > > You can't have 2 primary keys. A table can only have > one primary key. You can, however, also define a > Unique key, and if you set it up such that it is not > null, it will act much like a prmary key: > > CREATE TABLE test > ( id1 INT UNSIGNED NOT NULL, > PRIMARY KEY (id1), > id2 INT UNSIGNED NOT NULL, > UNIQUE KEY (id2), > data VARCHAR(25) > ); > > Hope that helps, > Mark > > --- Carlos Vazquez <[EMAIL PROTECTED]> wrote: > > Hi all! > > > > Just wanted to know how do I create a table with > two > > primary keys. > > > > Thanks a lot! > > > > __________________________________ Do you Yahoo!? The New Yahoo! Shopping - with improved product search http://shopping.yahoo.com -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]