How to delete unique index in mysql

WBOY
Release: 2022-05-16 15:37:09
Original
19433 people have browsed it

Delete method: 1. Use the alter table statement to delete, the syntax is "alter table data table name drop index the index name to be deleted;"; 2. Use the drop index statement to delete, the syntax is "drop index to delete The index name on the data table name;".

How to delete unique index in mysql

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

How to delete a unique index in mysql

Method 1: ALTER TABLE statement

alter table 数据表名 drop index 删除的索引名;
Copy after login

According to the syntax of the ALTER TABLE statement, this statement can also be used Delete index. The specific method of use is to specify part of the syntax of the ALTER TABLE statement as one of the following clauses.

DROP PRIMARY KEY: Indicates deleting 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: Indicates to delete the index named index_name.

DROP FOREIGN KEY fk_symbol: Indicates deleting the foreign key.

The example is as follows:

alter table news drop index title_sy;
Copy after login

How to delete unique index in mysql

Method 2:Use DROP INDEX statement

drop index 索引名 on 数据表名;
Copy after login

Examples are as follows:

drop index http_sy on news;
Copy after login

How to delete unique index in mysql

Recommended learning:mysql video tutorial

The above is the detailed content of How to delete unique index in mysql. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!