使用mysql生成唯一序列
作者:互联网
新建表如下:
CREATE TABLE `ticket` ( `id` bigint(20) unsigned NOT NULL auto_increment, `replace_key` char(1) NOT NULL default '', PRIMARY KEY (`id`), UNIQUE KEY `replace_key` (`replace_key`)) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=100001;
执行语句
REPLACE INTO `ticket` (`replace_key`) VALUES ('a');SELECT LAST_INSERT_ID();
标签:NULL,KEY,replace,key,mysql,序列,ticket,生成,id 来源: https://www.cnblogs.com/lfh-blog/p/16645265.html