mysql 自增字段的问题

跑路的蛤蟆 2008-03-19 04:05:50
我想让我的字段像这样递增 0001 0003 0005 0007 .....应该怎么办,在线等
...全文
114 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
跑路的蛤蟆 2008-03-20
  • 打赏
  • 举报
回复
不好意思,好像还是不能做间隔,有谁能帮帮我
懒得去死 2008-03-19
  • 打赏
  • 举报
回复
如果要间隔为2的话,就只能

set global auto_increment_increment =2;
懒得去死 2008-03-19
  • 打赏
  • 举报
回复

create table t_auto (id int(4) unsigned zerofill not null auto_increment primary key, num int not null);
insert into t_auto(num) values (10),(333),(344);
select * from t_auto;


结果:
query result(3 records)
id num
0001 10
0002 333
0003 344

56,675

社区成员

发帖
与我相关
我的任务
社区描述
MySQL相关内容讨论专区
社区管理员
  • MySQL
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧