Py学习  »  DATABASE

如何使用mysql unix_timestamp()作为自动增量的起点?

Astonvish32 • 6 年前 • 376 次点击  

我想知道是否可以创建一个以unix时间戳(表的创建时间)的值开始自动递增的表,即。

create table something(
    something_id bigint not null primary key auto_increment,
    something_name varchar(10) not null,
    something_random varchar(3) not null
) engine=InnoDB auto_increment=round(unix_timestamp(curtime(4)) * 1000);

注意,我可以 auto_increment=round(unix_timestamp(curtime(4)) * 1000) 价值 select round(unix_timestamp(curtime(4)) * 1000); . 但是我想要的是一种在创建表时自动执行的方法。

阅读后 mysql select section 我所做的一切都给了我一个编译器错误。

谢谢。

Python社区是高质量的Python/Django开发社区
本文地址:http://www.python88.com/topic/44280
文章 [ 1 ]  |  最新文章 6 年前