1、MySQL字段设置为填充零操作
CREATE TABLE `user` ( `id` int(4) unsigned zerofill NOT NULL AUTO_INCREMENT, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4;
INSERT INTO `user` (`id`) VALUES (1),(10),(100),(1000);
select * from user;
2、PostgreSQL填充零操作
SELECT LPAD(create_user::text, 8, '0') FROM file