gpt4 book ai didi

mysql插入查询 "Column count doesn' t匹配值计数“其中列和值都相等

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

Mysql插入查询“列计数与值计数不匹配”,其中列和值都相等

表结构:

:角色

:

ID int(11) AI PK 
NAME varchar(25)
LEVEL varchar(1)
DESCRIPTION varchar(200)
CREATED_DATE datetime
CREATED_BY varchar(32)
MODIFIED_DATE datetime
MODIFIED_BY varchar(32)

我的插入语句是:

INSERT INTO `role` VALUES 
(1,'user','T','Default role for all user','2016-09-19 08:22:34','admin','2016-09-19 08:22:34','admin'),
(2,'admin','T','System admin','2016-09-19 08:22:34','admin','2016-09-19 08:22:34','admin'),
(3,'super','T','Super Admin','2016-09-19 08:22:34','admin','2016-09-19 08:22:34','admin'),
(4,'host_user','H','Test','2016-09-19 08:22:34','admin','2016-09-19 08:22:34','admin'),
(5,'host_admin','H','Demo','2016-09-19 08:22:34','admin','2016-09-19 08:22:34','admin'),
(6,'host_super','H','again Test','2016-09-19 08:22:34','admin','2016-09-19 08:22:34','admin');

最佳答案

您已指定 ID AS AI(自动增量)主键。当您指定不需要在插入值中传递主键时。尝试删除它们:

INSERT INTO `role` VALUES 
('user','T','Default role for all user','2016-09-19 08:22:34','admin','2016-09-19 08:22:34','admin'),
('admin','T','System admin','2016-09-19 08:22:34','admin','2016-09-19 08:22:34','admin'),
('super','T','Super Admin','2016-09-19 08:22:34','admin','2016-09-19 08:22:34','admin'),
('host_user','H','Test','2016-09-19 08:22:34','admin','2016-09-19 08:22:34','admin'),
('host_admin','H','Demo','2016-09-19 08:22:34','admin','2016-09-19 08:22:34','admin'),
('host_super','H','again Test','2016-09-19 08:22:34','admin','2016-09-19 08:22:34','admin');

关于mysql插入查询 "Column count doesn' t匹配值计数“其中列和值都相等,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46139113/

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