A syntax error was found near to:
在以下位置找到语法错误:
Create table *** (
'id'...
'sid'...
'api_name'...
...
PRIMARY KEY (`id`) COMMENT '',
KEY `idx_sid` (`sid`) COMMENT '',
KEY `idx_api_name` (`api_name`)
)
what's wrong here?
这有什么不对?
2 个解决方案
#1
2
The problem is the column names were wrap with single quotes when it should be backtick if it's a reserved keyword.
问题是如果列名称是保留关键字,则应该使用单引号进行换行。
Wrapping column names with single quotes converts the identifier into string literals.
使用单引号包装列名称会将标识符转换为字符串文字。
Create table ***
(
id...
sid...
api_name...
...
PRIMARY KEY (`id`) COMMENT '',
KEY `idx_sid` (`sid`) COMMENT '',
KEY `idx_api_name` (`api_name`)
)
#2
0
Field names must not be enclosed with quotes (') but with back-ticks (`).
字段名称不能用引号(')括起来,而是带有反斜杠(`)。
Enclosing field names with back-ticks is only necessary if:
只有在以下情况下,才需要使用反向标记包含字段名称:
- The field name has more than one word (separated with spaces)
- The field name is a reserved keyword
字段名称有多个单词(用空格分隔)
字段名称是保留关键字
#1
2
The problem is the column names were wrap with single quotes when it should be backtick if it's a reserved keyword.
问题是如果列名称是保留关键字,则应该使用单引号进行换行。
Wrapping column names with single quotes converts the identifier into string literals.
使用单引号包装列名称会将标识符转换为字符串文字。
Create table ***
(
id...
sid...
api_name...
...
PRIMARY KEY (`id`) COMMENT '',
KEY `idx_sid` (`sid`) COMMENT '',
KEY `idx_api_name` (`api_name`)
)
#2
0
Field names must not be enclosed with quotes (') but with back-ticks (`).
字段名称不能用引号(')括起来,而是带有反斜杠(`)。
Enclosing field names with back-ticks is only necessary if:
只有在以下情况下,才需要使用反向标记包含字段名称:
- The field name has more than one word (separated with spaces)
- The field name is a reserved keyword
字段名称有多个单词(用空格分隔)
字段名称是保留关键字