gpt4 book ai didi

在 UNIQUE KEY 附近的 CREATE TABLE 中的 MySQL 查询语法错误

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

我在 MySQL 中执行了这个查询,但它显示 Unique key statement 附近的语法错误。谁能帮我清除错误?

      CREATE TABLE IF NOT EXISTS `friends` (
`Id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`providerId` int(10) unsigned NOT NULL DEFAULT '0',
`requestId` int(10) unsigned NOT NULL DEFAULT '0',
`status` binary(1) NOT NULL DEFAULT '0', PRIMARY KEY (`Id`),

UNIQUE KEY `Index_3` (`providerId`,`requestId`),
KEY `Index_2` (`providerId`,`requestId`,`status`))
ENGINE=InnoDB DEFAULT CHARSET=latin1
COMMENT='providerId is the Id of the users who wish to be friend with' AUTO_INCREMENT=7 ;

错误信息如下:

错误 1064(42000):您的 SQL 语法有误;查看与您的 MySQL 服务器版本相对应的手册,了解在 ''Id') 附近使用的正确语法,UNIQUE KEY Index_2(providerId,requestId),KEY Index_3 (providerId,requ' at line 1

最佳答案

末尾有不必要的,

`status` binary(1) NOT NULL DEFAULT '0', PRIMARY KEY (`Id`),

关于在 UNIQUE KEY 附近的 CREATE TABLE 中的 MySQL 查询语法错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18697090/

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