引言

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.


更多精彩文章,请移步我的个人博客:

Coolha:https://haxianhe.com/

最新文章

  1. django入门记录 2
  2. PHP之:PHP编程效率的20个要点
  3. 【笨嘴拙舌WINDOWS】设备无关图(*.bmp)
  4. jQuery plugins 图片上传
  5. 【JavaScript】父子页面之间跨域通信的方法
  6. C#基础--.net平台的重要组成部分以及.net程序简单的编译原理
  7. jQuery实现公告文字左右滚动的代码。
  8. Teach Yourself Scheme in Fixnum Days 6 recursion递归
  9. java多线程向数据库写入数据
  10. How to deploy openbr on linux server very shorly---- linuxmint13/ubuntu12.04 AMD64/debian7
  11. IPv6启动五年后,距离我们究竟还有多远?
  12. Oracle索引批量重置笔记
  13. cxf整合spring错误为:cvc-complex-type.2.4.c
  14. [原]CentOS7安装Rancher2.1并部署kubernetes (二)---部署kubernetes
  15. C#设计模式(3)——工厂方法模式(Factory Method)
  16. 吴裕雄 python 爬虫(3)
  17. java udp 广播
  18. 使用 RestTemplate 调用 restful 服务
  19. php安装amqp扩展
  20. C# 调用人脸识别 虹软ArcFace2.0实例

热门文章

  1. C# Task 的用法
  2. 《linux内核设计与实现》阅读笔记-进程与调度
  3. vue-resource.js的get和post的正确用法
  4. SQL Server 2012设置某用户对某些表的记录限制其删除操作
  5. string类总结第二部分实战练习
  6. yii中常用路径
  7. Numpy之数组创建
  8. HDU 3068:最长回文(Manacher算法)
  9. 看看大神 Paul Graham 对如何学习编程的回答
  10. 【全网首发】使用vs2017+qt5.12.4编译64位debug和release的qgis3.4.9