| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> c.d.o.tools -> Re: SQL unique fields
Use a compound key :
If table is named test_table and has columns named A and B ( along with any others) use
alter table test_table add constraint primary key (A,B);
to allow duplicate As or duplicate Bs but not duplicate (A&B)
hth,
Alessandro Raimondo <alessandro.raimondo_at_cern.ch> wrote:
>Hi,
>I would like to have a mySQL table with two fields used as unique key
>contemporaneously.
>To explain me: if A and B are the two fields I want that become
>impossible to insert two records with the same A & B, but that is
>possible to insert records with equal A or B.
>For example a software name (A) with different release number (B).
>
>May be it's someting easy, but I don't find the answer on the manual.
>
>thank you
>
>Alessandro
-----= Posted via Newsfeeds.Com, Uncensored Usenet News =----- http://www.newsfeeds.com - The #1 Newsgroup Service in the World! -----== Over 80,000 Newsgroups - 16 Different Servers! =----- Received on Tue Jun 06 2000 - 00:00:00 CDT
![]() |
![]() |