文件名称:mysql表数据定时随机生成.txt
文件大小:3KB
文件格式:TXT
更新时间:2023-08-18 10:43:35
mysql
定时事件: DELIMITER $$ ALTER DEFINER=`root`@`%` EVENT `NewEvent` ON SCHEDULE EVERY 30 SECOND STARTS '2018-10-08 14:00:00' ON COMPLETION NOT PRESERVE ENABLE DO CALL update_a()$$ DELIMITER ; 储存过程随机数: DELIMITER $$ USE `figure`$$ DROP PROCEDURE IF EXISTS `update_a`$$ CREATE DEFINER=`root`@`%` PROCEDURE `update_a`() UPDATE fs_weather SET temperature = ROUND (3.0 + (RAND() * 1.0),1), humidity =ROUND (75.0 + (RAND() * 1.0),1), noise =ROUND(25.0 + (RAND() * 45.0),1), pm = ROUND(8.0 + (RAND() * 5.0),1), wind_speed = CONCAT('东南风;',ROUND(2.0 + (RAND() * 1.0),1)), oxygen = FLOOR(35200 + (RAND() * 400)), pressure = ROUND(86.0 + (RAND() * 1.0),1), rainfall = ROUND(0.5 + (RAND() * 0.5),1) WHERE id = '1'$$ DELIMITER ;