如何更改 MySQL 列定义?
我有一个名为 test 的 mySQL 表:
I have a mySQL table called test:
create table test(
locationExpect varchar(120) NOT NULL;
);
我想将 locationExpect 列更改为:
I want to change the locationExpect column to:
create table test(
locationExpect varchar(120);
);
如何快速完成?
推荐答案
您的意思是在创建表后对其进行更改吗?如果是这样,您需要使用 alter table,特别是:
Do you mean altering the table after it has been created? If so you need to use alter table, in particular:
ALTER TABLE tablename MODIFY COLUMN new-column-definition
例如
ALTER TABLE test MODIFY COLUMN locationExpect VARCHAR(120);
相关文章