MySQL Forums
Forum List  »  MySQL Administrator

Constrain non-key column to have unique values?
Posted by: Matt Benic
Date: December 09, 2009 04:01AM

Is it possible to set a column in a table to have unique values without including it in the key? I have a table "locales" with two columns, "locale_id" and "name". While I want "locale_id" to be the key column used for lookups, I also want to ensure that "name" remains unique. Setting the "name" column as a key column seems to result in the id/name combination being constrained as unique but not the individual column.

Thanks

Options: ReplyQuote


Subject
Written By
Posted
Constrain non-key column to have unique values?
December 09, 2009 04:01AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.