创建表时添加约束
作者:互联网
查询表中搞得约束信息:show keys from 表名;
示例:创建depts表包含department_id该列为主键且自动增长,department_name列不允许重复,location_id列不允许含有空值;
create table depts (department_id int primary key auto_increment,department_name varchar(30) unique,location_id int not null);
使用navicat查看:
标签:name,int,创建,表时,添加,location,depts,department,id 来源: https://www.cnblogs.com/myx3/p/16437664.html