打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
there can be only one TIMESTAMP column with CURRENT_TIMESTAMP in DEFAULT or ON UPDATE clause
create table `product_category` (
    `category_id` int not null auto_increment,
    `category_name` varchar(64) not null comment '类目名字',
    `category_type` int not null comment '类目编号',
    `create_time` timestamp not null default current_timestamp comment '创建时间',
    `update_time` timestamp not null  default current_timestamp on update current_timestamp  comment '修改时间',
    primary key (`category_id`),
    unique key `uqe_category_type` (`category_type`)
);
create table `product_category` (
    `category_id` int not null auto_increment,
    `category_name` varchar(64) not null comment '类目名字',
    `category_type` int not null comment '类目编号',
    `create_time` timestamp not null comment '创建时间',
    `update_time` timestamp not null  DEFAULT current_timestamp  comment '修改时间',
    primary key (`category_id`),
    unique key `uqe_category_type` (`category_type`)
);
上面sql在5.5版本会报如下错误:
Incorrect table definition; there can be only one TIMESTAMP column with CURRENT_TIMESTAMP in DEFAULT or ON UPDATE clause
在5.7版本不会报错
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
mysql建表多个timestamp
mysql 报错 异常 exception
MySQL timestamp时间戳自动更新时间的问题
MySQL中的datetime与timestamp比较
[MySQL] mysql 5.5和 5.6 timestamp default 默认值CURRENT_TIMESTAMP问题
Otter双A同步搭建入门教程
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服