查询表中的约束信息:
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);
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);