Use event schedule and stored procedure to automatically average every hour MySQL
Run this in MySQL

SET GLOBAL event_scheduler = ON;


Add this to my.cnf so the scheduler remains enabled upon mysql restart

[mysqld]
event_scheduler = ON


Start the Event on the Next Hour, Make it Recurring Every Hour, Adjusting WHERE clause

CREATE EVENT hourly_temp_avg
    ON SCHEDULE
    EVERY HOUR
    STARTS DATE(NOW()) + INTERVAL (HOUR(NOW())+1) HOUR
    ON COMPLETION PRESERVE
DO
INSERT INTO `table1` (`dateavg`, `avg_temperature`) 
SELECT `DATE` , avg(`temperature`)
FROM `new_table`
WHERE `date` &gt;= NOW() - INTERVAL 1 HOUR;


Masoud came up with the proper concept first. So, he gets +1 from me.