uni UNIQUE 表示唯一 写法 id bigint(20) unsigned UNIQUE default NULL
mul 添加了索引 写法: alter table test add index suoyin (col_name1)
如果有同时存在,
显示顺序 PRI>UNI>MUL
你这样设置之后,是不能插入的空(NULL),而是能插入空串(\\'\\')。如果不让插入空串,应该使用check,例如:
CREATE TABLE table2 (
title varchar(50) NOT NULL,
message varchar(200) NOT NULL DEFAULT \\'内容\\',
msname varchar(50) NOT NULL DEFAULT \\'发布人\\',
date date NOT NULL,
PRIMARY KEY (`title`) ,
CHECK (title!=\\'\\')
)
PRI primary key 表示主键,唯一写法: id bigint(20) unsigned primary key not null ,uni UNIQUE 表示唯一 写法 id bigint(20) unsigned UNIQUE default NULL
mul 添加了索引 写法: alter table test add index suoyin (col_name1)
如果有同时存在,
显示顺序 PRI>UNI>MUL
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)