Assuming that you have a table called 'test' where there are three columns
'a', 'b' and 'c'.

Now you have 'a'+'b' as unique but neither only 'a' nor 'b'.

To specify that, define a and b both combined as primary key for the table,
as in the following statement:

CREATE TABLE `test` (
`a` TINYINT NOT NULL,
`b` TINYINT NOT NULL,
`c` TINYINT NOT NULL,
PRIMARY KEY (`a`, `b`)
);
       
This would achieve exactly what you want,

With regards,
Kundan


On 11/28/01 10:18 PM, "Etienne Marcotte" <[EMAIL PROTECTED]> wrote:

> When creating a table, can we specify that the combinaison of two fields
> needs to be unique but each of those two fields may have duplicates,
> just not both the same?
> 
> Can we have a required attribute on one of two fields? I have
> phone_line_french and phone_line_english, i require one of those two to
> be filled (or both). I can check that in my script, just asking if we
> can do it in mySQL
> 
> Regards,
> 
> Etienne


---------------------------------------------------------------------
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