How to set a unique key in MySQL
This article is about how to set the unique key in MySQL, the editor thinks it is very practical, so I share it with you to learn. I hope you can get something after reading this article.
One: modify the table, for example
[sql]
ALTER TABLE tablename ADD UNIQUE [name of index] (list of columns)
Www.2cto.com
Two: specify the index when creating the table, for example
[sql]
CREATE TABLE tablename ([...], UNIQUE [name of index] (list of columns))
The above is how to set the unique key in MySQL. The editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.