Skip to content

Course home

Additional programming techniques

Additional programming techniques

EasyMedium
123
Question 1

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:

FieldnameDescription
LogDateThe date the reading was taken
DeviceIDThe unique ID of the sensor
DeviceTypeThe type of sensor – Thermostat, Humidity, or CO2
ReadingThe numerical measurement

The log is stored in a database table called sensor_logs. The current contents of sensor_logs are shown:

LogDateDeviceIDDeviceTypeReading
12/10/2023TH_A1Thermostat22
12/10/2023HM_B3Humidity45
13/10/2023CO_C1CO2410
13/10/2023TH_A2Thermostat26
14/10/2023HM_B3Humidity55
14/10/2023TH_A1Thermostat25
15/10/2023CO_C2CO2390

Write an SQL statement to display the device IDs of the thermostat devices that have recorded a reading of more than 24.

[3]
Markscheme

Additional programming techniques Questions

  1. GCSE
  2. /Computer Science
  3. /Additional programming techniques

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.

Question bank