Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

UNIQUE keys

Status
Not open for further replies.

thegman

Programmer
Oct 16, 2001
26
GB
Is it possible to make a two UNIQUE keys in a MySQL table which work together? i.e. I have two fields in a table, either one can be the non-unique in different records, but not at the same time.

so in programming terms, it's like saying

if (Value1 is unique AND Value2 is unique) {
CANNOT MAKE RECORD
} else {
MAKE RECORD
}

If you see what I mean.
 
do you meant this ?

CREATE TABLE blaa(
first_name varchar(25) NOT NULL,
last_name varchar(25) NOT NULL,
blaa varchar(255),
primary key (first_name,last_name)
)

persons can have same first name or same last name but
not same both names. :)

cheers devnull22
(Knowledge Base Center )

--
Apparently if you play the Windows NT CD backwards you hear satanic messages. If you think that's bad, play it forwards and it installs Windows NT !
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top