[Asm] 纯文本查看 复制代码create table Administrators
(
aid char(10) not null,
apassword varchar(20) not null,
aname varchar(20) not null,
aidn varchar(18) not null,
primary key (aid)
);
insert into Administrators values('bx1','123456','ren','441078788946176647');
insert into Administrators values('bx2','123456','ren2','441096488946776666');
create table Bankcard
(
bnumber varchar(19) not null,
uid char(10) not null,
bpassword varchar(20) not null,
bstate char(6) not null,
bbalance float not null,
primary key (bnumber)
);
insert into Bankcard values('9874561478596412354','1','123456','normal','99999999');
insert into Bankcard values('2034571478566417614','2','123456','normal','99999999');
alter table Bankcard add constraint FK_hold foreign key (uid)
references t_user (uid) on delete restrict on update restrict;
create table Manage
(
aid char(10) not null,
bnumber int not null,
mtype char(2) not null,
mtime datetime not null,
primary key (aid, bnumber)
);
alter table Manage add constraint FK_Manage foreign key (aid)
references Administrators (aid) on delete restrict on update restrict;
alter table Manage add constraint FK_Manage2 foreign key (bnumber)
references Bankcard (bnumber) on delete restrict on update restrict;
create table t_user
(
uid char(10) not null,
upassword varchar(20) not null,
uname varchar(20) not null,
uidn varchar(18) not null,
primary key (uid)
);
insert into t_user values('1','123456','ren','449846133576135564');
insert into t_user values('2','123456','ren2','497846132574131561');
create table Record
(
rnumber varchar(20) not null,
bnumber varchar(19) not null,
uid char(10) not null,
rtime datetime not null,
rbnumber varchar(20) not null,
tamount float not null,
ttype char(2) not null,
primary key (rnumber)
);
alter table Record add constraint FK_query foreign key (uid)
references t_user (uid) on delete restrict on update restrict;
alter table Record add constraint FK_transaction foreign key (bnumber)
references Bankcard (bnumber) on delete restrict on update restrict;
insert into record values('8175195301','2034571478566417614','1',now(),'9874561478596412354','99999','deposit');
CREATE TABLE u_account (
uid CHAR(10) NOT NULL,
uname VARCHAR(20) NOT NULL,
bnumber VARCHAR(19) NOT NULL,
bbalance FLOAT NOT NULL,
botime varchar(30),
FOREIGN KEY (uid)
REFERENCES t_user (uid)
);
insert into u_account values('1','ren','449846133576135564','6516152','');
insert into u_account values('2','ren2','497846132574131561','9846666','');
update u_account a left join bankcard b on a.key=b.key set a.bbalance=b.bbalance;