gpt4 book ai didi

mysql - 基于此模式插入数据的正确结构是什么?

转载 作者:行者123 更新时间:2023-11-28 23:21:37 25 4
gpt4 key购买 nike

<分区>

我有一个如下所示的表模式:

mysql> desc category;
+-------------+--------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-------------+--------------+------+-----+---------+----------------+
| id | int(11) | NO | PRI | NULL | auto_increment |
| name | varchar(255) | NO | | NULL | |
| create_date | datetime | NO | | NULL | |
+-------------+--------------+------+-----+---------+----------------+
3 rows in set (0.01 sec)

我已尝试插入数据,但仍然出现此错误:

mysql> INSERT INTO category (id, name, create_date) VALUES (NULL, Family Events, 2016-25-12 00:00:00), (NULL, Work Events, 2016-25-12 00:00:00);
ERROR 1064 (42000): 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 'Events, 2016-25-12 00:00:00), (NULL, Work Events, 2016-25-12 00:00:00)' at line 1

我尝试了其他几种方法都得到了相同的结果,但我还没有找到任何好的文档。

我试过这个:

mysql> INSERT INTO category(id, name, create_date) VALUES(NULL, 'Family Events', 'NOW()');

得到这个错误:

ERROR 1292 (22007): Incorrect datetime value: 'NOW()' for column 'create_date' at row 1

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