批量更新uuid 如果直接用UUID(), 更新的数据是重复的
update user set invite_code = REPLACE(UUID(), '-', '') where invite_code is null;
如果需要批量更新,不同的UUID(),根据提供的UUID() 是不能实现的,但是可以通过MD5的形式进行实现
update user set invite_code = MD5(id+FLOOR(RAND() * 999999)) where invite_code is null;
如果对批量生成的伪UUID 长度不满意,可以进行修改
update user set invite_code = left(MD5(id+FLOOR(RAND() * 999999)),20) where invite_code is null;
如果想将批量生成的伪UUID 转大写可以这样
update user set invite_code = left(upper(MD5(id+FLOOR(RAND() * 999999))),20) where invite_code is null;