MySQL - 负 double 和字符语法 1064 错误

标签 mysql sql database syntax mysql-error-1064

我在 MySQL 中尝试将新数据插入数据表时收到错误 1064。我已经查找了该错误,但找不到任何解决该问题的 Stack Overflow 问题。

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

以下是该表的说明:

+-----------+---------+------+-----+---------+----------------+
| 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)

这是我尝试插入的示例行:

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

这是我收到的错误:

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

如果这确实与问题重复,我深表歉意,但我对 MySQL 很陌生,并且多次查看了我试图插入的数据行。

最佳答案

您忘记了关键字VALUES

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

关于MySQL - 负 double 和字符语法 1064 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34770985/

相关文章:

mysql - MySQL 中将 varchar 数据类型转换为 datetime

mongodb - 删除 mongodb 中的旧记录

具有一些用户定义字段的 SQL 数据库设计

c# - 以编程方式创建数据库关系

PHP 在多维数组中使用 array_replace

sql - 在 SQL 中比较月份和年份

php - laravel 5 迁移向我的数据库表添加了一些主键。如何预防呢?

ruby - 为什么 datamapper 不更新记录/检测脏度?

MySQL join, count and group by 多个数据库

php - while($row = mysql_fetch_array($result)) 对于 "for loop"的等效语法是什么