我在 MySQL 数据库中有 3 个表:
CREATE TABLE bank(
idBank int(11) NOT NULL PRIMARY KEY auto_increment,
nameBank varchar(50)
);
CREATE TABLE region(
idRegion int(11) NOT NULL PRIMARY KEY auto_increment,
address varchar(50) NOT NULL,
district varchar(30) NOT NULL,
city varchar(50) NOT NULL,
tel varchar(15) NOT NULL
);
CREATE TABLE branch(
idBranch int(11) NOT NULL PRIMARY KEY auto_increment,
idBank int(11) NOT NULL,
idRegion int(11) NOT NULL,
quantity int(50) NULL,
president varchar(60) NULL,
FOREIGN KEY (idBank) REFERENCES bank (idBank),
FOREIGN KEY (idRegion) REFERENCES region (idRegion)
);
当我尝试将值插入表中时,它适用于前两个,但不记录到分支表中。为什么?