gpt4 book ai didi

mysql - 如何使用引用在mysql中编写级联查询

转载 作者:行者123 更新时间:2023-11-30 23:00:48 25 4
gpt4 key购买 nike

<分区>

这是我的查询。但它不起作用。它显示此错误:

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 23

查询:

CREATE TABLE tbl_student 
(
studentrollno INT(11),
studentname VARCHAR(255),
studentpassword VARCHAR(255),
studentslug VARCHAR(300),
studentstatus VARCHAR(255),
degreetitle VARCHAR(100),
batchtitle VARCHAR(100),
batchautomationno VARCHAR(100),
PRIMARY KEY (studentrollno),
FOREIGN KEY (degreetitle) REFERENCES tbl_batch(degreetitle)
ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (batchtitle) REFERENCES tbl_batch(batchtitle)
ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (batchautomationno) REFERENCES tbl_batch(batchautomationno)
ON DELETE CASCADE ON UPDATE CASCADE,
)

这是我的批处理表

CREATE TABLE tbl_batch (
degreeTitle varchar(100),
batchTitle varchar(100),
batchAutomationNo varchar(100),
batchSlug varchar(255),
batchStatus int(1),
PRIMARY KEY (degreeTitle, batchTitle, batchAutomationNo),
FOREIGN KEY (degreeTitle)
REFERENCES tbl_degree(degreeTitle)
ON DELETE CASCADE
ON UPDATE CASCADE

) ENGINE=InnoDB;

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com