How to delete the auto-incrementing primary key in mysql

王林
Release: 2020-10-19 10:58:53
Original
8052 people have browsed it

How to delete the auto-increment primary key in mysql: First, you need to delete auto_increment; then execute the [alter table data table name drop primary key;] statement to delete the primary key.

How to delete the auto-incrementing primary key in mysql

Deleting the primary key in MySQL requires the following two steps

(Recommended tutorial:mysql video tutorial)

(1) If there is auto_increment, delete it first;

(2) Delete the primary key constraint primary key

alter table t9 modify id int(11); #这里用的modify,只改变数据类型,也可以用change,改变列名的同时输入新的数据类型。 alter table t9 drop primary key; #删除主键
Copy after login

Related recommendations:mysql tutorial

The above is the detailed content of How to delete the auto-incrementing primary key 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!