gpt4 book ai didi

mysql - 尝试填充数据库时出现 SQL 语法错误 1064

转载 作者:行者123 更新时间:2023-11-29 05:45:32 24 4
gpt4 key购买 nike

我不断收到以下错误消息

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 ''isbn10','isbn13','title','edition','author_f_name','author_m_name','author_l_na' at line 1

当尝试使用以下命令从 MySQL 命令行填充我的 MySQL 数据库时:

source C:\myFilePath\myFileName.sql

这是我的 mysqldump 的摘录(显示书的表结构)。

我哪里出错了?:

--
-- Table structure for table `book`
--

DROP TABLE IF EXISTS `book`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `book` (
`book_id` int(11) NOT NULL AUTO_INCREMENT,
`isbn10` char(20) DEFAULT NULL,
`isbn13` char(20) DEFAULT NULL,
`title` char(20) DEFAULT NULL,
`edition` char(20) DEFAULT NULL,
`author_f_name` char(20) DEFAULT NULL,
`author_m_name` char(20) DEFAULT NULL,
`author_l_name` char(20) DEFAULT NULL,
`cond` enum('as new','very good','good','fair','poor') DEFAULT NULL,
`price` decimal(8,2) DEFAULT NULL,
`genre` char(20) DEFAULT NULL,
PRIMARY KEY (`book_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `book`
--
USE books;

INSERT INTO book ('isbn10','isbn13','title','edition','author_f_name','author_m_name','author_l_name','cond','price','genre')
VALUES ('0136061699','978-0136061694','Software Engineering: Theory and Practice','4th Edition','Shari','Lawrence','Pfleeger','very good','50','Computing');

最佳答案

不要在列名称周围使用单引号。单引号表示字符串,您不使用字符串作为列名。

尝试将脚本更改为:

USE books;

INSERT INTO book (isbn10, isbn13, title, edition, author_f_name,
author_m_name, author_l_name, cond, price, genre)
VALUES ('0136061699', '978-0136061694',
'Software Engineering: Theory and Practice','4th Edition',
'Shari','Lawrence','Pfleeger','very good','50','Computing');

关于mysql - 尝试填充数据库时出现 SQL 语法错误 1064,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2655147/

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