Will Leshner wrote:

On Dec 31, 2003, at 4:56 AM, D. Richard Hipp wrote:


1.  There can only be one PRIMARY KEY, but multiple UNIQUE constraints
    are allowed.



Ah. This one I didn't know. I thought that multiple columns could participate in the PRIMARY KEY. But I just tested it and sure enough I get an error when I try to make more than one column be the PRIMARY KEY.



You CAN have a multi-column primary key. You just have to do it all at once using a "PRIMARY KEY" clause, not the PRIMARY KEY attribute on the column. Ex:

   CREATE TABLE ex1(
      a TEXT,
      b VARCHAR(10),
      c FLOAT,
      PRIMARY KEY(b,a)
   );

In the example above, the primary key consists of columns b and a,
in that order.


-- D. Richard Hipp -- [EMAIL PROTECTED] -- 704.948.4565


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to