Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我了解如何用随机值填充字段,但我需要我的字段自动更新每个新列的随机值。出于某种原因,我无法弄清楚如何做到这一点。
顺便说一句,正如上面所说,这是针对 MySQL 中的数据库的。
感谢大家
您可以使用触发器在插入后更新特定列,如下所示:
DELIMITER | CREATE TRIGGER randtrigger AFTER INSERT ON your_table FOR EACH ROW BEGIN UPDATE your_table SET some_column = rand() WHERE id = NEW.id; END; | DELIMITER ;