At 8:54 PM +0300 9/17/99, Michael Widenius wrote:
>>>>>> "WJ" == WJ Gilmore <gilmore@stripped> writes:
>WJ> Hi there.
>WJ> I would like to clear a minor bit of confusion that I have been having
>WJ> regarding the creation of table columns and whether to use PRIMARY KEY
>WJ> or UNIQUE to set up a column that will contain a unique value.
>>> From the docs., it seems as if there is no real distinction between the
>WJ> definition of PRIMARY KEY and UNIQUE. Is this true? I ask this because
>WJ> it seems as if the docs go through quite a bit of trouble to denote each
>WJ> when necessary.
>WJ> In short, are they one in the same? If not, could somebody please list
>WJ> the differences?
>The only difference is that a PRIMARY key is named 'PRIMARY' while an
>UNIQUE KEY may have any name.
In addition, there may be only one PRIMARY KEY, whereas you can have
multiple UNIQUE indexes (though that is fairly unusual).
A PRIMARY KEY is a UNIQUE index, but a UNIQUE index may not necessarily
be a PRIMARY KEY.
Paul DuBois, paul@stripped