sql報(bào)錯(cuò) 說實(shí)在第二行
CREATE TABLE seckill (
?'seckill_id' ?BIGINT ? ? ? NOT NULL AUTO_INCREMENT
?COMMENT '商品庫存ID',
?'name' ? ? ? ?VARCHAR(120) NOT NULL
?COMMENT '庫存名稱',
?'number' ? ? ?INT ? ? ? ? ?NOT NULL
?COMMENT '庫存數(shù)量',
?'start_time' ?TIMESTAMP ? ?NOT NULL
?COMMENT '秒殺開啟時(shí)間',
?'end_time' ? ?TIMESTAMP ? ?NOT NULL
?COMMENT '秒殺結(jié)束時(shí)間',
?'create_time' TIMESTAMP ? ?NOT NULL DEFAULT current_timestamp
?COMMENT '創(chuàng)建時(shí)間',
?PRIMARY KEY (seckill_id),
?KEY idx_start_time(start_time),
?KEY idx_end_time(end_time),
?KEY idx_create_time(create_time)
)
?ENGINE = InnoDB
?AUTO_INCREMENT = 1000
?DEFAULT CHARSET = utf8
?COMMENT ='秒殺庫存表';
一下是報(bào)錯(cuò)信息
[2018-03-05 10:50:28] [42000][1064] 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 ''seckill_id'? BIGINT? ? ? ?NOT NULL AUTO_INCREMENT
[2018-03-05 10:50:28] COMMENT '商品庫存ID',
[2018-03-05 10:50:28] ' at line 2
2018-03-05
在mysql里,單引號(hào)不是這個(gè),要改成這樣的`seckill_id`,COMMENT里的中文備注單引號(hào)則不變。
2018-03-05
在mysql的建表語句里 列名需要用分隔符 也就是 鍵盤1 左邊的?
``
comment 還是繼續(xù)使用 單引號(hào) ''