[ACCEPTED]-mysql combined unique keys-unique-constraint
You can define an index on multiple columns, e.g.:
CREATE UNIQUE INDEX arbitrary_index_name ON table_name (title, store);
Yes. Instead of two separate unique constraints 6 you should create a single unique constraint 5 on both columns.
CREATE INDEX syntax is:
CREATE [UNIQUE|FULLTEXT|SPATIAL] INDEX index_name [index_type] ON tbl_name (index_col_name,...) [algorithm_option | lock_option] ...
For your 4 example it would look something like this:
CREATE UNIQUE INDEX index_name ON tbl_name (title,store);
You 3 will also have to drop the two incorrect 2 unique indexes that you created.
See the 1 documentation for more details on how to create indexes.
You need a multi-column unique key.
table_name ADD UNIQUE INDEX(
More Related questions