执行一个查询时出现错误语法
I obtain a error syntax when I exceute one query
我需要创建 table 并且我这样做了:
CREATE TABLE "home" (
"id" int(11) NOT NULL AUTO_INCREMENT,
"address" varchar(200) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
PRIMARY KEY ("id")
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=latin1 COLLATE=latin1_bin;
当我执行此查询时出现此错误:
Errore SQL [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 '"causali" (
"id" int(11) NOT NULL AUTO_INCREMENT,
"address" va' at line 1
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 '"home" (
"id" int(11) NOT NULL AUTO_INCREMENT,
"adddress" va' at line 1
谁能帮帮我?
MySQL 不喜欢 table / 列 / 别名上的双引号,直到我们启用 ANSI_QUOTES
模式。
Treat " as an identifier quote character (like the ` quote character)
and not as a string quote character. You can still use backticks to quote
identifiers with this mode enabled. With ANSI_QUOTES enabled, you
cannot use double quotation marks to quote literal strings because
they are interpreted as identifiers.
此模式默认禁用。现在,您可以在它们周围使用反引号,或者不使用双引号(除非是 Reserved keyword,否则您将不得不在其周围使用反引号)。
CREATE TABLE home (
id int(11) NOT NULL AUTO_INCREMENT,
address varchar(200) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
PRIMARY KEY (id)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=latin1 COLLATE=latin1_bin;
我需要创建 table 并且我这样做了:
CREATE TABLE "home" (
"id" int(11) NOT NULL AUTO_INCREMENT,
"address" varchar(200) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
PRIMARY KEY ("id")
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=latin1 COLLATE=latin1_bin;
当我执行此查询时出现此错误:
Errore SQL [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 '"causali" (
"id" int(11) NOT NULL AUTO_INCREMENT,
"address" va' at line 1
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 '"home" (
"id" int(11) NOT NULL AUTO_INCREMENT,
"adddress" va' at line 1
谁能帮帮我?
MySQL 不喜欢 table / 列 / 别名上的双引号,直到我们启用 ANSI_QUOTES
模式。
Treat " as an identifier quote character (like the ` quote character) and not as a string quote character. You can still use backticks to quote identifiers with this mode enabled. With ANSI_QUOTES enabled, you cannot use double quotation marks to quote literal strings because they are interpreted as identifiers.
此模式默认禁用。现在,您可以在它们周围使用反引号,或者不使用双引号(除非是 Reserved keyword,否则您将不得不在其周围使用反引号)。
CREATE TABLE home (
id int(11) NOT NULL AUTO_INCREMENT,
address varchar(200) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
PRIMARY KEY (id)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=latin1 COLLATE=latin1_bin;