错误提示为:: 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 '})' at line 1创建的表为
CREATE TABLE `test_data` (
`order_id` BIGINT UNSIGNED NOT NULL COMMENT 'Order numbers. Must be unique.',
`status` BOOL NOT NULL DEFAULT '0' COMMENT 'Whether data has been used or not. A value of 0 means FALSE.',
`date_used` DATETIME NULL COMMENT 'Date/time that the data was used.',
UNIQUE (
`order_id`
)
) ENGINE = innodb COMMENT = 'LoadRunner test data';
CREATE TABLE `test_data` (
`order_id` BIGINT UNSIGNED NOT NULL COMMENT 'Order numbers. Must be unique.',
`status` BOOL NOT NULL DEFAULT '0' COMMENT 'Whether data has been used or not. A value of 0 means FALSE.',
`date_used` DATETIME NULL COMMENT 'Date/time that the data was used.',
UNIQUE (
`order_id`
)
) ENGINE = innodb COMMENT = 'LoadRunner test data';
从你的报错提示上看,'})' 这个符号根本没有出现在你提供的这句上,应该是另外一句有问题。注意那个大括号}mysql> CREATE TABLE `test_data` (
-> `order_id` BIGINT UNSIGNED NOT NULL COMMENT 'Order numbers. Must be unique.',
-> `status` BOOL NOT NULL DEFAULT '0' COMMENT 'Whether data has been used or not. A value of 0 means FALSE.',
-> `date_used` DATETIME NULL COMMENT 'Date/time that the data was used.',
-> UNIQUE (
-> `order_id`
-> )
-> ) ENGINE = innodb COMMENT = 'LoadRunner test data';
Query OK, 0 rows affected (0.06 sec)mysql> select version();
+----------------------+
| version() |
+----------------------+
| 5.1.33-community-log |
+----------------------+
1 row in set (0.00 sec)mysql>
你贴出来的这个语句没有任何问题。 建议你也向我这样做测试。
从你的报错提示上看,'})' 这个符号根本没有出现在你提供的这句上,应该是另外一句有问题。注意那个大括号} 还是有错误啊:mysql> CREATE TABLE 'test_data'(
-> `order_id` BIGINT UNSIGNED NOT NULL COMMENT 'Order numbers. Must be uniqu
e.',
-> `status` BOOL NOT NULL DEFAULT '0' COMMENT 'Whether data has been used or
not. A value of 0 means FALSE.',
-> `date_used` DATETIME NULL COMMENT 'Date/time that the data was used.',
-> UNIQUE (
-> `order_id`
-> )
-> ENGINE = innodb COMMENT = 'LoadRunner test data';
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 ''test
_data'(
`order_id` BIGINT UNSIGNED NOT NULL COMMENT 'Order numbers. Must be' at line 1
mysql> select version();
+----------------------+
| version() |
+----------------------+
| 5.1.35-community-log |
+----------------------+
1 row in set (0.00 sec)mysql>
少了个括号!UNIQUE (
`order_id`
)
) ENGINE = innodb COMMENT = 'LoadRunner test data';
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 'test_
data' at line 1
mysql> CREATE TABLE 'test_data'(
-> `order_id` BIGINT UNSIGNED NOT NULL COMMENT 'Order numbers. Must be uniqu
e.',
-> `status` BOOL NOT NULL DEFAULT '0' COMMENT 'Whether data has been used or
not. A value of 0 means FALSE.',
-> `date_used` DATETIME NULL COMMENT 'Date/time that the data was used.',
-> UNIQUE (
-> `order_id`
-> )
-> ENGINE = innodb COMMENT = 'LoadRunner test data';
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 ''test
_data'(
`order_id` BIGINT UNSIGNED NOT NULL COMMENT 'Order numbers. Must be' at line 1
mysql> select version();
+----------------------+
| version() |
+----------------------+
| 5.1.35-community-log |
+----------------------+
1 row in set (0.00 sec)mysql>
-> `order_id` BIGINT UNSIGNED NOT NULL COMMENT 'Order numbers. Must be uniqu
e.',
-> `status` BOOL NOT NULL DEFAULT '0' COMMENT 'Whether data has been used or
not. A value of 0 means FALSE.',
-> `date_used` DATETIME NULL COMMENT 'Date/time that the data was used.',
-> UNIQUE (
-> `order_id`
-> )
-> ENGINE = innodb COMMENT = 'LoadRunner test data';已经讲过一遍了,你少了一个括号! ) ENGINE你能直接复制你顶楼的代码去执行吗?
'test_data'->`test_data`
' ' at line 6
CREATE TABLE `test_data` (
`order_id` BIGINT UNSIGNED NOT NULL COMMENT 'Order numbers. Must be unique.',
`status` BOOL NOT NULL DEFAULT '0' COMMENT 'Whether data has been used or not. A value of 0 means FALSE.',
`date_used` DATETIME NULL COMMENT 'Date/time that the data was used.',
UNIQUE (
`order_id`
)
) ENGINE = innodb COMMENT = 'LoadRunner test data';
`order_id` BIGINT UNSIGNED NOT NULL COMMENT 'Order numbers. Must be unique.',
`status` BOOL NOT NULL DEFAULT '0' COMMENT 'Whether data has been used or not. A value of 0 means FALSE.',
`date_used` DATETIME NULL COMMENT 'Date/time that the data was used.',
UNIQUE (
`order_id`
)
) ENGINE = innodb COMMENT = 'LoadRunner test data';