gpt4 book ai didi

mysql - INSERT INTO table IF table exists 否则创建表

转载 作者:搜寻专家 更新时间:2023-10-30 19:59:20 24 4
gpt4 key购买 nike

mysql支持这样吗?

INSERT INTO `table` VALUES (NULL,"1234") IF TABLE EXISTS `table` ELSE CREATE TABLE `table` (id INT(10), word VARCHAR(500));

最佳答案

我会创建 2 个语句。试试这个:

CREATE TABLE IF NOT EXISTS `table` (
id INT(10),
word VARCHAR(500)
);
INSERT INTO `table` VALUES (NULL,"1234");

关于mysql - INSERT INTO table IF table exists 否则创建表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21409628/

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