請問我寫的sql報錯語法錯誤是為什么?
mysql> create table seckill(
? ? -> seckill_id bigint not null AUTO_INCREMENT,
? ? -> name varchar(120) not null,
? ? -> number int not null,
? ? -> start_time timestamp not null default CURRENT_TIMESTAMP,
? ? -> end_time timestamp not null default CURRENT_TIMESTAMP,
? ? -> create_time timestamp not null default CURRENT_TIMESTAMP,
? ? -> 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;
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 'CURRENT_TIMESTAMP,
end_time timestamp not null default CURRENT_TIMESTAMP,
cr' at line 5
2017-04-03
CREATE TABLE seckill (
?`seckill_id` BIGINT NOT NULL AUTO_INCREMENT COMMENT '商品庫存ID',
?`name` VARCHAR (120) NOT NULL COMMENT '商品名稱',
?`number` INT NOT NULL COMMENT '庫存數(shù)量',
?`create_time` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '創(chuàng)建時間',
?`start_time` TIMESTAMP NOT NULL COMMENT '秒殺開啟時間',
?`end_time` TIMESTAMP NOT NULL COMMENT '秒殺結(jié)束時間',
?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-03
create_time 放在start_time前面