外键约束
CREATE table userinfo(
userid int PRIMARY KEY AUTO_INCREMENT,
username VARCHAR(50) not null,
usertel VARCHAR(11) not null,
userpwd VARCHAR(20) not null,
usertouxiang VARCHAR(100) not null,
chargeid int(1) check (chargeid=1 or chargeid=2 ) ,foreign key (chargeid)references chargetype(chargeid),
authorityid int(1) check (authorityid =1 or authorityid =2), foreign key (authorityid) references authoritytype(authorityid),
onlinestateid int(1) check(onlinestateid=1 or onlinestateid=2),foreign key (onlinestateid) references onlinestatetype(onlinestateid)
);