Responses for fallowing questions, using the farm
PostgreSQL database.
a. When did the outside sensor break and stop sending data?
SELECT device, min(recorded_at), max(recorded_at)
FROM sensor_data
GROUP by device
Outside sensor break down and stop sending data
b. Show the min and max temperature in the root cellar by year;
SELECT extract(YEAR FROM recorded_at)as day, device,
max(reading), min(reading), avg(reading)
FROM sensor_data
The minimum temperature in the root cellar; 27.80
and maximum temperature in the root cellar; 69.00
c. What was the lowest temperature recorded 2018?
SELECT extract(YEAR FROM recorded_at) ad day, device
max(reading), min(reading), avg(reading)
FROM sensor_data
WHERE mesurement=’temperature’
AND recorded_at BETWEEN’2018-01-01’ and ‘2018-12-31‘
GROUP BY day, device;
Outside temperature was the lowest one in 2018.
Write two queries that use data from your sensor.