Given a table that contains a history of spot readings from many different sensors
readings(sensor_id bigint, reading_ts timestamp, reading_value decimal)
show me the latest known reading for each sensor.Things I look at:
1. Does the candidate immediately reach for a window function?
2. Can they do it without a window function?
If the candidate fails at this stage, it's a no-hire, then I can use the same task to check their seniority.
3. Do they actually know the right window function?
4. Can they explain why a window function is better here than grouping in a subquery?
5. Can they do it in an imperative language?
If they can answer at least two out of three, they are a solid middle.
6. Can they suggest a way to store the data that makes the query take O(number of sensors) time?
Okay, this is a senior engineer.