An automated greenhouse system has a log that records data each time an environmental sensor takes a reading. The record format is given in the table:
| Fieldname | Description |
|---|---|
| LogDate | The date the reading was taken |
| DeviceID | The unique ID of the sensor |
| DeviceType | The type of sensor – Thermostat, Humidity, or CO2 |
| Reading | The numerical measurement |
The log is stored in a database table called sensor_logs. The current contents of sensor_logs are shown:
| LogDate | DeviceID | DeviceType | Reading |
|---|---|---|---|
| 12/10/2023 | TH_A1 | Thermostat | 22 |
| 12/10/2023 | HM_B3 | Humidity | 45 |
| 13/10/2023 | CO_C1 | CO2 | 410 |
| 13/10/2023 | TH_A2 | Thermostat | 26 |
| 14/10/2023 | HM_B3 | Humidity | 55 |
| 14/10/2023 | TH_A1 | Thermostat | 25 |
| 15/10/2023 | CO_C2 | CO2 | 390 |
Write an SQL statement to display the device IDs of the thermostat devices that have recorded a reading of more than 24.
5 exam-style questions on OCR GCSE Computer Science Additional programming techniques. Each one has a worked solution and a mark scheme showing where the marks go.