#主键约束并且自动增长
Primary key, Auto_increment;
#条件约束
check
#不为空,并且唯一
unique not null;
create table user(
id int primary key comment'主键',
name varchar(10) not null unique comment'姓名',
age int check(age > 0 && age <= 120)comment'年龄',
status char(1) default'1'comment'状态',
gender char(1) comment'性别'
)comment'用户表';
MYSQL各大外键约束以及DDL建表语句
最新推荐文章于 2024-07-03 12:42:39 发布