gpt4 book ai didi

mysql - mysql中没有插入数据

转载 作者:行者123 更新时间:2023-11-29 09:09:40 24 4
gpt4 key购买 nike

我有下表:

(是的,表名很愚蠢......我只是在搞乱)

CREATE TABLE  `habitat`.`habit` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`content` text NOT NULL,
`created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`deleted` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
`user_id` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8

当我尝试执行以下sql语句时,内容中仅显示0:

INSERT into habit
(content, user_id)
VALUES (content = 'this is some habit', user_id = 2)

最佳答案

基本上,您不需要在插入语句的 VALUES 部分中包含“columnName = value”。它应该看起来像这样。

INSERT INTO habit (
content,
user_id)
VALUES (
'this is some habit',
2)

关于mysql - mysql中没有插入数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5997932/

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