MySQL外键创建条件:
1.两个表必须是InnoDB数据引擎
2.外键表的外键字段必须是主键
3.字段类型必须一致
创建表时创建外键:
create table tbl_client(userName varchar(255) not null, address varchar(255), createDate timestamp not null default now(), createUserName varchar(255), foreign key(createUserName) references tbl_user(userName));