简体   繁体   English

我如何解决此错误 - ERROR 1064 (42000): 您的 SQL 语法有错误

[英]How can i resolve this error - ERROR 1064 (42000): You have an error in your SQL syntax

I'm failing to create this table我无法创建此表

CREATE TABLE `destinations` (
  `id` int(50) NOT NULL,
  `name` varchar(225) NOT NULL,
  `description` text NOT NULL,
  `code` int(50) NOT NULL,
  `menu_code` int(50) NOT NULL,
  `menu_position` int(50),
  `status` tinyint(3) NOT NULL,
  `price` DOUBLE(50) NOT NULL);

Take a look here:看看这里:

https://dev.mysql.com/doc/refman/5.6/en/keywords.html

The use of the words reserved by MySQL as column names.使用 MySQL 保留的词作为列名。

After you changed the name to covered `` the above does not work but you have an error in line 9. check the definition for DOUBLE将名称更改为 Covered `` 后,上述操作不起作用,但第 9 行出现错误。检查 DOUBLE 的定义

https://dev.mysql.com/doc/refman/5.5/en/floating-point-types.html

Try below - you don't need to specify data length for int type尝试以下 - 您不需要为 int 类型指定数据长度

CREATE TABLE `destinations` (
  `id` int NOT NULL,
  `name` varchar(225) NOT NULL,
  `description` text NOT NULL,
  `code` int NOT NULL,
  `menu_code` int NOT NULL,
  `menu_position` int,
  `status` tinyint(3) NOT NULL,
  `price` DOUBLE NOT NULL);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM