SQL语法错误1064 [英] SQL Syntax Error 1064
问题描述
我不断收到以下错误消息
I keep getting the following error message
错误1064(42000):您的SQL语法有错误;在第1行的"isbn10","isbn13","title","edition","author_f_name","author_m_name","author_l_na"附近,查看与您的MySQL服务器版本相对应的手册以获取正确的systax,以供使用.>
当尝试使用以下命令从(MySQL)命令行填充我的MySQL数据库时:
when trying to populate my MySQL database from the (MySQL) command line with the following command:
源C:\ myFilePath \ myFileName.sql
source C:\myFilePath\myFileName.sql
这是我的mysqldump的摘录(显示本书的表结构).我哪里做错了?任何帮助将不胜感激:
Here is an excerpt from my mysqldump (showing the table structure for book). Where did I go wrong? Any assistance will be appreciated:
--
-- 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`
--
********编辑********** 这是我的脚本(对不起,我忘了包含此脚本):
********EDIT********** Here is my script (sorry I forgot to include this):
使用书籍;
USE books;
在书中插入('isbn10','isbn13','title','edition','author_f_name','author_m_name','author_l_name','cond','price','genre') 值('0136061699','978-0136061694','软件工程:理论与实践','第四版','Shari','Lawrence','Pfleeger','非常好','50','计算' );
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');
推荐答案
不要在列名前后使用单引号.单引号表示字符串,列名称不使用字符串.
Don't use single quotes around the column names. Single quotes means strings, you don't use strings for column names.
尝试将脚本更改为此:
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');
这篇关于SQL语法错误1064的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!