PDA

View Full Version : begginer question how to make raw unique


umen242
11-08-2008, 08:50 PM
Hello all
im totally new to sql . ( im learning ..)
my question is : how can i make sure that the record in my table
will be unique based on several field for example :
if i have record that contains
foo1,foo2,foo3
and i like that the raw's will be unique based on the first 2 field
so that if i enter :
foo1,foo2,foo4
it will be not valid data , but if i enter
foo2,foo2,foo4
it will be valid
Thanks

bazz
11-09-2008, 01:41 AM
look up 'unique indexes'.

Include this in your create table statement.

UNIQUE INDEX make_unique_entries_ix ( field_name_1, filed_name_2, field_name_3 ),


bazz