gpt4 book ai didi

Mysql 结果由多行组成 SQL=INSERT INTO

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

第一次插入时出现以下错误:

Result consisted of more than one row.

当我第二次尝试插入记录时,出现错误并显示消息:重复条目

SQL:

INSERT INTO `master_user` (`name`,`user_name`,`email`,`password`,`system_name_of_friend`,`system_no_of_friend`,`registered_from_site`,`registered_on`,`is_existing_user`)
VALUES ('FirstName LastName','username','demo@mail.com','8c71eede42e38709e9e836021b0b9b9b','','','site','','1')

任何帮助将不胜感激,以下是表结构,将有助于跟踪此问题。

CREATE TABLE IF NOT EXISTS `master_user` (
`master_user_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`user_name` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL,
`email` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`password` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`system_name_of_friend` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`system_no_of_friend` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
`registered_from_ip` varchar(25) COLLATE utf8_unicode_ci DEFAULT NULL,
`registered_from_site` varchar(25) COLLATE utf8_unicode_ci DEFAULT NULL,
`registered_on` datetime DEFAULT NULL,
`is_existing_user` bit(1) NOT NULL DEFAULT b'0',
PRIMARY KEY (`master_user_id`),
UNIQUE KEY `ukMasterUser_email` (`email`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1293 ;

最佳答案

您应删除包含位值的',它会被解释为一个字符,超过 1 位。并将日期设置为 null,而不是插入 ''

INSERT INTO `master_user` (`name`,`user_name`,`email`,`password`,`system_name_of_friend`,`system_no_of_friend`,`registered_from_site`,`registered_on`,`is_existing_user`)
VALUES ('FirstName LastName','username','demo@mail.com','8c71eede42e38709e9e836021b0b9b9b','','','site',null,1);

SQLFiddle:http://sqlfiddle.com/#!2/eda2ff

关于Mysql 结果由多行组成 SQL=INSERT INTO,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27055339/

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