且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

mysql,alter column删除主键并自动增加

更新时间:2022-02-02 09:30:41

如果您需要在单个SQL语句中从id列中删除自动增量和主键,则应该这样做:

If you need to remove the auto-increment and the primary key from the id column in a single SQL statement, this should do:

ALTER TABLE companies DROP PRIMARY KEY, CHANGE id id int(11);

实际上,您应该能够在单个ALTER TABLE查询中完成所有操作:

In fact, you should be able to do everything in a single ALTER TABLE query:

ALTER TABLE companies
DROP PRIMARY KEY,
CHANGE id id int(11),
ADD PRIMARY KEY (uuid);