mysql> 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 CHARACTER SET=utf8 COMMENT='秒杀库存表';
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 ',
PRIMARY KEY (seckill_id),
key idx_start_time(start_time),
key idx_end_time(e' at line 7
-> `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
这个最后的逗号是中文逗号。
)ENGINE=InnoDB AUTO INCREMENT=1000 DEFAULT CHARACTER SET=utf8 COMMENT='秒杀库存表';
这个AUTO_INCREMENT
-- 创建秒杀数据库表 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 DEFAULT 0 COMMENT '秒杀开启时间', `end_time` timestamp not NULL DEFAULT 0 COMMENT '秒杀结束时间', `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', PRIMARY KEY PK_SECKILL_ID(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='秒杀库存表' ;