Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MySQl Error #1064

I keep getting this error:

MySQL said: #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 'INSERT INTO books.book(isbn10,isbn13,title,edition,author_f_name,author_m_na' at line 15

with this query:

USE books;

DROP TABLE IF EXISTS book;


    CREATE TABLE `books`.`book`(
    `book_id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
    `isbn10` VARCHAR(15) NOT NULL,
    `isbn13` VARCHAR(15) NOT NULL,
    `title` VARCHAR(50) NOT NULL,
    `edition` VARCHAR(50) NOT NULL,
    `author_f_name` VARCHAR(50) NOT NULL,
    `author_m_name` VARCHAR(50) NOT NULL,
    `author_l_name` VARCHAR(50) NOT NULL,
    `cond` ENUM('as new','very good','good','fair','poor') NOT NULL,
    `price` DECIMAL(8,2) NOT NULL,
    `genre` VARCHAR(50) NOT NULL,
    `quantity` INT NOT NULL)

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

Any idea what the problem is?

like image 564
Anthony Avatar asked Apr 24 '10 23:04

Anthony


People also ask

What is MySQL error?

Lost connection to MySQL server Network conditions should be checked if this is a frequent error. If an error message like “Lost connection to MySQL server” appears while querying the database, it is certain that the error has occurred because of network connection issues.

How do I find MySQL errors?

err" or --log-error=/var/log/mysql/error. log), the error log will be written to the specified file. In order to send the error log to the console on Windows, you must use the --console option; it overrides the --log-error option if both are present.

Why MySQL is not working?

normally means that there is no MySQL server running on the system or that you are using an incorrect Unix socket file name or TCP/IP port number when trying to connect to the server. You should also check that the TCP/IP port you are using has not been blocked by a firewall or port blocking service.


2 Answers

maybe you forgot to add ";" after this line of code:

`quantity` INT NOT NULL)
like image 85
Puaka Avatar answered Oct 03 '22 18:10

Puaka


In my case I was having the same error and later I come to know that the 'condition' is mysql reserved keyword and I used that as field name.

like image 24
KK2019 Avatar answered Oct 03 '22 17:10

KK2019