SQL Daily Intervention Rate per Robot From Task Logs

Last updated: November 29, 2026

Quick Overview

Given a table of task attempts by robots on a customer site and a table of human interventions during those attempts, write SQL that returns, for each robot and day, the number of attempts, the number of attempts that needed at least one intervention, and the intervention rate.

Figure AI
Data Manipulation (SQL/Python)
Data Engineer
Figure AI
November 29, 2026
Data Engineer
Technical Screen
Data Manipulation (SQL/Python)
Easy

0

0

0 solved


Given a table of task attempts by robots on a customer site and a table of human interventions during those attempts, write SQL that returns, for each robot and day, the number of attempts, the number of attempts that needed at least one intervention, and the intervention rate.

Figure AI reports robot reliability at deployments such as automotive and logistics sites, and interventions per task is a natural fleet health metric. This screen checks join correctness, avoiding double counting when one attempt has several interventions, and clean date bucketing.

What the Interviewer Expects
  • Uses a LEFT JOIN or EXISTS so attempts with no interventions are kept
  • Counts attempts with interventions, not intervention rows
  • Buckets by the attempt's day in a stated time zone
  • Avoids integer division in the rate
  • Mentions what to do with attempts still in progress
Key Topics to Cover
LEFT JOIN
Aggregation without fan-out
Date bucketing
Fleet reliability metrics
How to Approach This
  1. Clarify the schema and expected output format before writing queries.
  2. Use CTEs (WITH clauses) to break complex queries into readable steps.
  3. Consider window functions (ROW_NUMBER, RANK, LAG, LEAD) for ranking and sequential analysis.
  4. Watch for NULLs, duplicates, and edge cases in JOINs and GROUP BY.
  5. For pandas, prefer vectorized operations over row-by-row iteration.
Possible Follow-up Questions
  • How would you compute a 7-day rolling intervention rate per robot?
  • Interventions are logged by a separate service and arrive late; how do you keep the daily table correct?
  • How would you break the rate down by software release running on the robot?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice SQL Problems
Sample Answer
Clarify the Data

Assume task_attempts(attempt_id, robot_id, site_id, started_at, ended_at, status) and interventions(intervention_id, attempt_id, kind, created_at). One attempt can have zero or many interventions....

Approach

The trap is a plain join: an attempt with three interventions would count as three attempts. So I first collapse interventions to one row per attempt, then LEFT JOIN that onto attempts. A CASE or a bo...


Submit Your Answer
Markdown supported

Related Questions