Modify column Vs change column
引言
I know, we can not rename a column using modify column syntax,but can change column syntax.
My question is: what is the main usage of modify syntax?
For example,
alter table tablename change col1 col1 int(10) not null
instead of
alter table tablename modify col1 int(10) not null
Edited
Question replaced
What is the main usage of modify syntax?
Above question was replaced by below
Why we have to use change column instead of modify column?
解释
CHANGE COLUMN If you have already created your MySQL database, and decide after the fact that one of your columns is named incorrectly, you don't need to remove it and make a replacement, you can simply rename it using change column.
ALTER TABLE MyTable CHANGE COLUMN foo bar VARCHAR(32) NOT NULL FIRST;
MODIFY COLUMN This command does everything CHANGE COLUMN can, but without renaming the column.You can use the modify SQL command if you need to resize a column in MySQL. By doing this you can allow more or less characters than before. You can't rename a column using modify and other
ALTER TABLE MyTable MODIFY COLUMN foo VARCHAR(32) NOT NULL AFTER baz;
Note : ALTER TABLE is used for altering a table means to change column name, size, drop column. CHANGE COLUMN and MODIFY COLUMN commands cannot be used without help of ALTER TABLE command.
更多精彩文章,请移步我的个人博客:
最新文章
- django入门记录 2
- PHP之:PHP编程效率的20个要点
- 【笨嘴拙舌WINDOWS】设备无关图(*.bmp)
- jQuery plugins 图片上传
- 【JavaScript】父子页面之间跨域通信的方法
- C#基础--.net平台的重要组成部分以及.net程序简单的编译原理
- jQuery实现公告文字左右滚动的代码。
- Teach Yourself Scheme in Fixnum Days 6 recursion递归
- java多线程向数据库写入数据
- How to deploy openbr on linux server very shorly---- linuxmint13/ubuntu12.04 AMD64/debian7
- IPv6启动五年后,距离我们究竟还有多远?
- Oracle索引批量重置笔记
- cxf整合spring错误为:cvc-complex-type.2.4.c
- [原]CentOS7安装Rancher2.1并部署kubernetes (二)---部署kubernetes
- C#设计模式(3)——工厂方法模式(Factory Method)
- 吴裕雄 python 爬虫(3)
- java udp 广播
- 使用 RestTemplate 调用 restful 服务
- php安装amqp扩展
- C# 调用人脸识别 虹软ArcFace2.0实例