一:字段修饰符 1:null和not null修饰符 我们通过这个例子来看看 mysql> create table worker(id int not null,name varchar(8) not null,pass varchar(20) not null); mysql> insert into worker values(1,'HA','123456'); mysql> insert into worker values(1,'LB',null); ERROR 1048 (2
代码 alter table sfk_son_module add constraint foreign key(father_module_id) references sfk_father_module(id) on delete restrict on update restrict; (constraint 后面可以加上约束名字) 错误原因是之前两张表的id的类型不一样,一个时int,一个时bigint 解决办法时修改表, alter table sfk_father_module mo
MySQL 创建唯一索引忽略对已经重复数据的检查 在创建唯一索引的基础上加上关键字"IGNORE "即可. # 重复数据 mysql> select aid,count(aid) as total ,email,tel_no,account_type,exten,passwd from fudao_admin group by user_name having total> 1; +-------+-------+--------------------------+---