mysql-笔记-默认值

1 指定列的默认值

columnName int default '-1'

2 integer 列-设置自增列 也是指定默认值的方式

3 默认值必须是常量 不能使用函数、表达式---特例:timestamp datetime 列可以指定current_timestamp做为默认值

4 blob text geometry json 数据类型不能指定默认值

5 如果没有明确指定默认值,mysql会有一个默认的默认值:numeric 类型 默认0;第一个timestamp 列默认current date and time

字符串类型:默认是空字符串,enum类型默认是枚举的第一个值

6 查看表的默认值:show create table tablename

原文地址:https://www.cnblogs.com/caojuansh/p/10494783.html