Bird
0
0

You want to calculate the hourly average temperature for multiple rooms stored in InfluxDB on Raspberry Pi. Which query correctly groups data by room and hour?

hard🚀 Application Q8 of 15
Raspberry Pi - Data Logging and Databases
You want to calculate the hourly average temperature for multiple rooms stored in InfluxDB on Raspberry Pi. Which query correctly groups data by room and hour?
ASELECT mean("temperature") FROM "room_temps" WHERE time(1h) GROUP BY "room"
BSELECT mean("temperature") FROM "room_temps" GROUP BY "room" HAVING time(1h)
CSELECT mean("temperature") FROM "room_temps" GROUP BY time(1h) AND "room"
DSELECT mean("temperature") FROM "room_temps" GROUP BY time(1h), "room"
Step-by-Step Solution
Solution:
  1. Step 1: Understand GROUP BY syntax in InfluxDB

    Grouping by time intervals and tags uses comma-separated list: GROUP BY time(1h), "room".
  2. Step 2: Evaluate each option

    SELECT mean("temperature") FROM "room_temps" GROUP BY time(1h), "room" uses correct syntax; B misuses HAVING; A misuses WHERE; D uses invalid AND.
  3. Final Answer:

    SELECT mean("temperature") FROM "room_temps" GROUP BY time(1h), "room" -> Option D
  4. Quick Check:

    GROUP BY time and tag = comma-separated list [OK]
Quick Trick: Use comma to separate time and tag in GROUP BY [OK]
Common Mistakes:
MISTAKES
  • Using HAVING instead of GROUP BY
  • Using WHERE for grouping
  • Using AND instead of comma

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Raspberry Pi Quizzes