问答详情
源自:4-1 数据库设计与编码

为什么sql会报错啊谁知道

CREATE TABLE seckill (
 'seckill_id'  BIGINT       NOT NULL AUTO_INCREMENT
 COMMENT '商品库存id',
 'name'        VARCHAR(120) NOT NULL
 COMMENT '商品名称',
 'number'      INT          NOT NULL
 COMMENT '库存数量',
 'start_time'  TIMESTAMP    NOT NULL
 COMMENT '秒杀开始时间',
 'end_time'    TIMESTAMP    NOT NULL
 COMMENT '秒杀开始时间',
 'create_time' TIMESTAMP    NOT NULL DEFAULT current_timestamp
 COMMENT '创建时间',
 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 = '秒杀数据库';




报错为:

[2017-04-21 09:25:39] [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

[2017-04-21 09:25:39] COMMENT '商品库存id',

[2017-04-21 09:25:39] ' at line 2


提问者:End13147 2017-04-21 09:27

个回答

  • End13147
    2017-04-21 09:44:17

    后面看答案才发现 是 `  而不是单引号