一、NULL
定义方式:NULL(默认) NOT NULL
二、comment
用来描述字段,会根据创建语句保存,可用show create table 表名; 查看
create table my_tab(
str varchar(10) not null comment ‘字符串‘,
num int unsigned not null comment ‘数字‘
);
三、default
用来设置默认值。
create table my_tab(
str varchar(10) not null,
num int unsigned default 10; -- 默认值为10
);
使用方法:
insert into my_tab (str) values (‘abc‘); -- num会自动设为10
insert into my_tab values (‘abc‘, default); -- 用默认值插入num字段
原文:http://www.cnblogs.com/pengyin/p/6366564.html