RE: user defined table constraint

2004-10-21 Thread Josh Howe
PROTECTED] Subject: Re: user defined table constraint You need to use a UNIQUE index: ALTER TABLE table ADD UNIQUE user_id_primary (user_id, is_primary); I can't find a specific section about UNIQUE indexes in the mysql docs, but I'm sure it's there and I'm pretty sure the syntax about is correct

Re: user defined table constraint

2004-10-13 Thread SGreen
That depends, can the user have more than 2 records? as in only 1 yes record and 1 no record? If that were the case you could create a unique index on (user_id, is_primary). However, I suspect that is not the case. If I remember my M$ $QL correctly, User Constraints are evaluated during INSERT

Re: user defined table constraint

2004-10-13 Thread Rhino
Excuse me for top-posting but Outlook Express won't put revision bars in front of your original remarks and I'm too lazy to type them all in myself ;-) Anyway, if you define one of your columns, such as user_id as a primary key, you can be sure that there will never be two rows with the same