发布网友 发布时间:2022-04-25 13:14
共1个回答
热心网友 时间:2022-04-10 02:44
update test set id = UUID();MYSQL默认值设置UUID函数实际其函数除TIMESTAMP外都 MYSQL默认值目前能数或者CURRENTTIMESTAMP
需要实现UUID默认值功能则该表INSERT触发器实现:
update test set id = UUID();
create TRIGGER test_insert
AFTER INSERT ON test
FOR each ROW
BEGIN
update test set id = UUID();
end;
般主键id都用AUTO_INCREMENTuuid()适合做主键