小知识点--随机插入航班价格

update `t_flight` set flight_price=floor(rand()*10000);

update `t_flight` set flight_price=rand(); //零点几(6位小数点) 乘以十,向下取整.就是1到9
0.610935
0.279636
0.638298

如 638.298 向下取整,丢弃小数点,保留整数638

============随机500到1200之间范围的价格

SELECT FLOOR(500 + (rand() * 600));

第一个参数为最低数字,第二个最高数字,(参数的2倍)

原文地址:https://www.cnblogs.com/bj-tony/p/5492371.html