sensor_readings (reading_id, sensor_id, temp_c) holds temperature readings. The sensors' firmware writes -999 when a reading failed; some failed rows were also loaded with temp_c NULL. Both mean "no reading".
For each sensor report:
- •
valid_readings: how many real readings it has - •
avg_temp_c: the average of its real readings, rounded to 1 decimal place (NULL if it has none)
Every sensor in the table must appear, even one with no real readings.
Columns: sensor_id, valid_readings, avg_temp_c. Sort by sensor_id.