Search code examples
mysqlsqldatabasesyntaxmysql-error-1064

MySQL - Error in Syntax 1064 with Negative Doubles and Chars


I'm getting an error 1064 in MySQL trying to insert new data into a data table. I've looked up the error already and couldn't find any Stack Overflow questions addressing the problem.

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

Here is a description of the table:

+-----------+---------+------+-----+---------+----------------+
| Field     | Type    | Null | Key | Default | Extra          |
+-----------+---------+------+-----+---------+----------------+
| id        | int(11) | NO   | PRI | NULL    | auto_increment |
| coord1lat | double  | NO   |     | NULL    |                |
| coord1lon | double  | NO   |     | NULL    |                |
| coord3lat | double  | NO   |     | NULL    |                |
| coord3lon | double  | NO   |     | NULL    |                |
| status    | char(1) | NO   |     | NULL    |                |
+-----------+---------+------+-----+---------+----------------+
6 rows in set (0.00 sec)

and here is a sample row of what I'm trying to insert:

insert into sample_parking_spots (null, 47.60624, -122.299735, 47.60226, -122.299687, 'T');

and here is the error I'm getting in return:

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 'null, 47.60624, -122.299735, 47.60226, -122.299687, 'T')' at line 1

I apologize if this does end up being a duplicate of a question, but I am very new to MySQL and looked several times through the data row I was trying to insert.


Solution

  • you forgot the Keyword VALUES

    insert into sample_parking_spots VALUES (null, 47.60624, -122.299735, 47.60226, -122.299687, 'T');