This is similar to the previous query in terms of the information we require in order to obtain the average:
const getAverageOfReadingsBetweenTime = (type, start, end,
callback) => { db.get(`SELECT avg(value) FROM temperature WHERE
createdAt > ? AND createdAt < ?;`, [start, end], callback) }
In this function, we're using the get method instead of the all method since we expect only one reading to be returned.