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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Making a field unique

Status
Not open for further replies.

DrumAt5280

Technical User
Sep 8, 2003
194
US
I have a table that has city names, some cities like Springfield occur in multiple states.

I use MySQL-Front for inputting my data. Anyone out there use this application too?

Can I get MySQL-Front to alert me when i have just entering an item that already exists with that field so I know to rename a city like Springfield-MO?
 
I don't know anything about MySQL_Front, but you can define either a primary key or a unique index on the table, which will reject any attempt to insert a record with a duplicate value for the associated field:
[tt]
ALTER TABLE cities ADD UNIQUE (cityname);
[/tt]
or
[tt]
ALTER TABLE cities ADD PRIMARY KEY (cityname);
[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top