measurements has one row per sensor reading (measurement_id, measurement_value, measurement_time) where measurement_time is the reading's day. Within each day, number the readings 1, 2, 3, ... in measurement_id order. For each day, return the average value of the odd-numbered readings and of the even-numbered readings (NULL if a day has no even-numbered reading). Output columns: measurement_time, odd_avg, even_avg (both rounded to 2 decimals). Order by measurement_time ascending.
| Column | Type |
|---|---|
| measurement_id | INTEGER |
| measurement_value | REAL |
| measurement_time | DATE |
| measurement_id | measurement_value | measurement_time |
|---|---|---|
| 1 | 10 | 2026-01-01 |
| 2 | 20 | 2026-01-01 |
| 3 | 30 | 2026-01-01 |
| 4 | 40 | 2026-01-01 |
| 5 | 50 | 2026-01-02 |
| 6 | 60 | 2026-01-02 |
| measurement_time | odd_avg | even_avg |
|---|---|---|
| 2026-01-01 | 20 | 30 |
| 2026-01-02 | 50 | 60 |
Solve it in the live editor on this page — run on sample data, then submit against hidden tests.
‹ Complete Service Bundle Subscribers · Mismatched Fulfillment Items ›
{{ totalCount }} questions in the style asked at Amazon, Microsoft, Google, Meta, Flipkart and more — {{ hardPct }}% Hard. Write SQL in a real database engine in your browser, run it on sample data, then evaluate against hidden tests.
Company tags show where this type of question is commonly reported in interviews. Questions, data and solutions are written by TechTown.
{{ cur.statement }}
No submissions yet. Press Evaluate to submit your query.
{{ solutionSql }}
{{ out.error }}
You have solved your 3 free questions — nice work! Log in (free) to unlock all 150 questions, keep your streak and appear on the leaderboard.