On 11-Jul-01 Joshua Stewart wrote:
> umm when i declare a unique constraint on 2 fields in a table like so
>
> unique (col1,col2),
>
> if i insert data into the table will it check them individually or as a
> composite?
>
Composite
(1,1)
(1,2)
(2,1)
(2,2)
(1,2) < error duplicate
(2,1) < error duplicate
> for example if i inserted the values
> col1 | col2
> 1, A
> 1, B
> 2, B
> 2, A
>
> if the above unique constraint is declared will it give me errors when
> inserting?
should be fine, what error did you get when you tried it ?
> neither col1 or col2 are a primary key but together they could be
> considered a composite candidate key pair
>
That why it allows such things.
--
Don Read [EMAIL PROTECTED]
-- It's always darkest before the dawn. So if you are going to
steal the neighbor's newspaper, that's the time to do it.
---------------------------------------------------------------------
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