We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CREATE TABLE seckill( seckill_id BIGINT NOT NUll AUTO_INCREMENT COMMENT '商品库存ID', name VARCHAR(120) NOT NULL COMMENT '商品名称', number int NOT NULL COMMENT '库存数量', create_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', start_time TIMESTAMP NOT NULL COMMENT '秒杀开始时间', end_time TIMESTAMP NOT NULL 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='秒杀库存表'; --把 create_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP 这条语句放在start_time 前面, --原因是mysql会默认为表中的第一个timestamp字段(且设置了NOT NULL)隐式设置DEFAULAT CURRENT_TIMESTAMP。 -- 所以默认的顺序设置实际上等同于设置了两个CURRENT_TIMESTAMP,因此而报错,调整之后就可以了。
seckill_id
name
number
create_time
start_time
end_time
The text was updated successfully, but these errors were encountered:
No branches or pull requests
CREATE TABLE seckill(
seckill_id
BIGINT NOT NUll AUTO_INCREMENT COMMENT '商品库存ID',name
VARCHAR(120) NOT NULL COMMENT '商品名称',number
int NOT NULL COMMENT '库存数量',create_time
TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',start_time
TIMESTAMP NOT NULL COMMENT '秒杀开始时间',end_time
TIMESTAMP NOT NULL 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='秒杀库存表';
--把 create_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP 这条语句放在start_time 前面,
--原因是mysql会默认为表中的第一个timestamp字段(且设置了NOT NULL)隐式设置DEFAULAT CURRENT_TIMESTAMP。
-- 所以默认的顺序设置实际上等同于设置了两个CURRENT_TIMESTAMP,因此而报错,调整之后就可以了。
The text was updated successfully, but these errors were encountered: