faqts : Computers : Databases : MySQL : Language and Syntax : Table Rules : Unique

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

21 of 27 people (78%) answered Yes
Recently 8 of 10 people (80%) answered Yes

Entry

What is UNIQUE() used for?
Would INDEX name (last_name,first_name)) prevent duplicate entries?

May 10th, 2000 20:12
Nathan Wallace, indrek siitan


An index will allow duplicate values.  You have to use

    UNIQUE (last_name,first_name)

for that to stop duplicates.

An INDEX tells MySQL to optimize its storage to make queries that rely
on looking up those fields as fast as possible.