gpt4 book ai didi

java - 是否有类似 IF NOT EXISTS 的命令用于插入值?

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

<分区>

CREATE TABLE IF NOT EXISTS Orari (ID int AUTO_INCREMENT PRIMARY KEY,titolo Char(40), sala int ,giorno char(10),Ora char(10));

INSERT INTO Orari VALUES (null,null,1,'lunedi','16:30'),
(null,null,1,'lunedi','19:30'),
(null,null,2,'lunedi','16:30'),
(null,null,2,'lunedi','19:30'),
(null,null,1,'martedi','16:30'),
(null,null,1,'martedi','19:30'),
(null,null,2,'martedi','16:30'),
(null,null,2,'martedi','19:30'),
(null,null,1,'mercoledi','16:30'),
(null,null,1,'mercoledi','19:30'),
(null,null,2,'mercoledi','16:30'),
(null,null,2,'mercoledi','19:30'),
(null,null,1,'giovedi','16:30'),
(null,null,1,'giovedi','19:30'),
(null,null,2,'giovedi','16:30'),
(null,null,2,'giovedi','19:30'),
(null,null,1,'venerdi','16:30'),
(null,null,1,'venerdi','19:30'),
(null,null,2,'venerdi','16:30'),
(null,null,2,'venerdi','19:30'),
(null,null,1,'sabato','16:30'),
(null,null,1,'sabato','19:30'),
(null,null,2,'sabato','16:30'),
(null,null,2,'sabato','19:30'),
(null,null,1,'domenica','16:30'),
(null,null,1,'domenica','19:30'),
(null,null,2,'domenica','16:30'),
(null,null,2,'domenica','19:30');

我想把它放在我每次按下按钮时都会调用的函数中。

IF NOT EXISTS 用于第一个查询……如果表已经存在,则不会重新创建它。

但是每次我按下按钮时,第二个插入值的查询只会一次又一次地插入。

是否有类似 IF NOT EXISTS 的命令用于插入值?

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