gpt4 book ai didi

mysql - SQL 错误 - 空自动递增

转载 作者:太空宇宙 更新时间:2023-11-03 12:18:29 25 4
gpt4 key购买 nike

我正在做一个 mySQL 教程来学习如何编写 sql 语句。我不断得到这个:

 #1064 - 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 ''add_delete_record' ( 'id' int(11) NOT NULL AUTO_INCREMENT, 'content' text' at line 1

这是我正在使用的 sql:

CREATE TABLE IF NOT EXISTS 'add_delete_record' (
'id' int(11) NOT NULL AUTO_INCREMENT,
'content' text NOT NULL,
PRIMARY KEY ('id')
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

这是教程给出的确切代码,所以我不确定教程是否比我的 mysql(v5.5) 版本旧,或者我是否遗漏了一些小错误。

最佳答案

您应该使用反引号 (`) 而不是单引号 (')。

  CREATE TABLE IF NOT EXISTS `add_delete_record` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`content` text NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

sql fiddle

关于mysql - SQL 错误 - 空自动递增,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21105957/

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