Get the App
SLTechnology News&Howtos  ›  Database  › 

How to set a unique key in MySQL

Shulou Source: shulou.com Published: 2022-05-31 21:06:15 11月20日 Update

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.

Tags: Index name more knowledge article practical that is work meeting article time read knowledge point industry details information information channel follow part channel learning Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno macOS Shulou Information vpn MariaDB Linux