MySQL 如何更改表列数据类型
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/12932168/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 15:12:55 来源:igfitidea点击:
how to alter table column data type
提问by Reham Fahmy
I've the following column
我有以下专栏
hits text NOT NULL
and want to alter it to
并想将其更改为
hits bigint(20) unsigned NOT NULL default '0'
how to use ALTER TABLE commands to do this change ! ~ thanks
如何使用 ALTER TABLE 命令进行此更改!~谢谢
回答by PyQL
ALTER TABLE table_name MODIFY hits bigint(20) unsigned NOT NULL default '0';
回答by hims056
Try Alter tablesyntax:
尝试更改表语法:
ALTER TABLE tbl_name
MODIFY [COLUMN] col_name column_definition
[FIRST | AFTER col_name]
So your query should be:
所以你的查询应该是:
ALTER TABLE tbl_name
MODIFY hits bigint(20) unsigned NOT NULL default '0';
回答by Habibillah
Try read alter table syntax
尝试读取更改表语法
alter table YourTableName
change column hits hits bigint(20) unsigned NOT NULL default '0';