MySQL ----约束


 

 实例:创建如下表

 

大小写不敏感

create table user(
id int primary key auto_increment comment '主键 ',
name varchar(10) unique not null comment '姓名 ',
age int check(age>0 && age <=120) comment '年龄 ',
status char(1) default '1' comment '状态',
gender char(1) comment '性别 '
)comment '用户';

实例

实例:

 实例