如何更改MySQL列定义? [英] How to change MySQL column definition?
本文介绍了如何更改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);
这篇关于如何更改MySQL列定义?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文