Get the App
SLTechnology News&Howtos  ›  Database  › 

How does mysql delete a unique index

Shulou Source: shulou.com Published: 2022-05-31 10:43:13 09月27日 Update

This article mainly explains "how to delete the unique index in mysql". The content in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "how to delete the unique index in mysql".

Delete method: 1, use alter table statement to delete, syntax is "alter table data table name drop index to delete index name;"; 2, use drop index statement to delete, syntax is "drop index to delete index name on data table name;"

The operating environment of this tutorial: windows10 system, mysql8.0.22 version, Dell G3 computer.

How does mysql delete a unique index

Method 1: ALTER TABLE statement

Alter table Datasheet name drop index deleted index name

According to the syntax of the ALTER TABLE statement, it can also be used to delete an index. The specific way to use it is to specify part of the syntax of the ALTER TABLE statement as one of the following clauses.

DROP PRIMARY KEY: means to delete the primary key in the table. A table has only one primary key, and the primary key is also an index.

DROP INDEX index_name: means to delete an index named index_name.

DROP FOREIGN KEY fk_symbol: means to delete a foreign key.

Examples are as follows:

Alter table news drop index title_sy

Method 2: use the DROP INDEX statement

Drop index index name on data table name

Examples are as follows:

Drop index http_sy on news

Thank you for reading, the above is the content of "how to delete the unique index of mysql", after the study of this article, I believe you have a deeper understanding of how to delete the unique index of mysql, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Tags: Indexes statements data data tables methods grammar learning content examples usage only names clauses that is ideas situations tutorials articles more versions Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno OPPO Reno MySQL vpn macOS Linux