| | 92 | |
| | 93 | Q4 - Insert |
| | 94 | {{{ |
| | 95 | INSERT INTO weatherdata_copy (log_date, time, station, temp, humidity, airpressure, wind, visibility, winddirection) |
| | 96 | VALUES ( |
| | 97 | CONCAT('2025-', LPAD(${RANDOM_MONTH}, 2, '0'), '-', LPAD(${RANDOM_DAY}, 2, '0')), |
| | 98 | '12:00:00', |
| | 99 | ${RANDOM_STATION}, |
| | 100 | ROUND(${__Random(0,35)}.${__Random(0,9)}, 2), |
| | 101 | ROUND(${__Random(30,95)}.${__Random(0,9)}, 2), |
| | 102 | ROUND(${__Random(950,1050)}.${__Random(0,99)}, 2), |
| | 103 | ROUND(${__Random(0,50)}.${__Random(0,99)}, 2), |
| | 104 | NULL, |
| | 105 | ROUND(${__Random(0,359)}) |
| | 106 | ) ON DUPLICATE KEY UPDATE |
| | 107 | temp = VALUES(temp), |
| | 108 | humidity = VALUES(humidity), |
| | 109 | pressure = VALUES(pressure) |
| | 110 | }}} |
| | 111 | |
| | 112 | Q5 - Update |
| | 113 | {{{ |
| | 114 | UPDATE weatherdata_copy |
| | 115 | SET temp = ROUND(temp + 0.1, 2), |
| | 116 | humidity = ROUND(humidity * 1.02, 2), |
| | 117 | pressure = ROUND(pressure + 0.5, 2) |
| | 118 | WHERE log_date = '2024-06-15' |
| | 119 | AND station = ${RANDOM_STATION} |
| | 120 | LIMIT 500 |
| | 121 | }}} |
| | 122 | |
| | 123 | Q6 - Delete |
| | 124 | {{{ |
| | 125 | DELETE FROM weatherdata_copy |
| | 126 | WHERE log_date < '2020-06-01' |
| | 127 | LIMIT 1000 |
| | 128 | }}} |
| | 129 | |