From: johng@mm.com (TurkBear)
Subject: Re: SQL unique fields
Date: 2000/06/06
Message-ID: <393d34fc.3312312@news.news-ituk.to>#1/1
X-Report: Please report illegal or inappropriate use to <abuse@newsfeeds.com> You may also use our online abuse reporting from: http://www.newsfeeds.com/abuseform.htm
Content-Transfer-Encoding: 7bit
References: <393D2CDD.EA750D07@cern.ch>
Content-Type: text/plain; charset=us-ascii
X-Comments: This message was posted through Newsfeeds.com
X-Abuse-Info: Please be sure to forward a copy of ALL headers, INCLUDING the body (DO NOT SEND ATTACHMENTS)
X-Trace: 6 Jun 2000 12:36:25 -0500, 156.98.4.11
X-Authenticated-User: 6fd2d0c3
Organization: Newsfeeds.com http://www.newsfeeds.com 73,000+ UNCENSORED Newsgroups.
MIME-Version: 1.0
Reply-To: See Message body for real address
Newsgroups: comp.databases,comp.databases.oracle.misc
X-Comments2: IMPORTANT: Newsfeeds.com does not condone, nor support,  spam or any illegal or copyrighted postings.
X-Comments3: IMPORTANT: Under NO circumstances will postings containing illegal or copyrighted material through this service be tolerated!!



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@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! =-----


