Home > Database > Mysql Tutorial > body text

MySQL修改字段默认值

WBOY
Release: 2016-06-07 15:18:30
Original
2471 people have browsed it

环境 MySQL 5.1 命令行工具 问题 MySQL 修改字段默认 解决 alter table topic alter column cateId set default '2'; 语法总结 alter table 表名 alter column 字段名 drop default; ( 若本身存在默认,则先删除 ) alter table 表名 alter column 字段名 set

环境

MySQL 5.1 + 命令行工具

 

问题

MySQL修改字段默认值

 

解决

alter table topic alter column cateId set default '2';

 

语法总结

 

alter table表名alter column字段名drop default; (若本身存在默认值,则先删除)

 

alter table表名 alter column字段名 set default默认值;(若本身不存在则可以直接设定)

 

参考资料

 

http://blog.sina.com.cn/s/blog_79936154010103fw.html

 

 

 

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!