Dataford
Interview QuestionsInterview GuidesExperiencesCoaching
New
Pricing
Get started
Dataford
Popular roles
Software EngineerData AnalystData ScientistData EngineerBusiness AnalystAI EngineerMachine Learning EngineerProduct Manager
Browse
Browse All RolesEvery role hub, from analyst to MLBrowse All CompaniesCompany-specific interview loopsAll Interview GuidesThe full guide library
Top questions by role
Software EngineerData AnalystData ScientistData EngineerBusiness AnalystAI EngineerMachine Learning EngineerProduct Manager
Top questions by skill
SQLPythonStatisticsMachine LearningA/B TestingSystem DesignGenerative AIProduct SenseMetricsBehavioral
Browse all questions →Try a mock interview
Experiences
Practice
Mock InterviewsTimed interview simulations with feedbackCoaching1:1 coaching with people at your target companiesSuccess PathYour 6-week structured planModulesCurated lessons by topicWebinarsTalks from ex-Big Tech data leadsPlaygroundA free-form scratch editor
Learn
BlogInterview strategy and career adviceTech Job Market ReportHiring trends across data and AI rolesFor UniversitiesDataford for career centersAbout DatafordWho we are and how we build
Pricing
Build my plan
Top Error Codes Before Shutdown
00:00
5 left

Top Error Codes Before Shutdown

MediumSQL · PostgreSQL

Problem

Given a table of robot telemetry events and a table of maintenance logs, find the top three most frequent error codes that occur within 15 minutes prior to a hardware shutdown at Amazon Robotics.

Write a PostgreSQL query. Include events exactly 15 minutes before shutdowns, exclude events at or after shutdown time, and ignore telemetry rows without an error code.

Output

  1. Exactly three rows with error_code and frequency
  2. Count each qualifying telemetry event and shutdown pair
  3. Sort by frequency descending, then error_code ascending

Schema

robot_telemetry_events
ColumnTypeDescription
event_idPKINTUnique telemetry event identifier
robot_idVARCHAR(20)Identifier of the robot that emitted the event
event_timestampTIMESTAMPTime when the telemetry event occurred
error_codeVARCHAR(40)Telemetry error code, when present
maintenance_logs
ColumnTypeDescription
maintenance_idPKINTUnique maintenance log identifier
robot_idVARCHAR(20)Identifier of the affected robot
maintenance_typeVARCHAR(40)Type of maintenance activity
shutdown_timestampTIMESTAMPTime of the hardware shutdown, when applicable
Tablesrobot_telemetry_eventsmaintenance_logs
Interviewer

Your question is Top Error Codes Before Shutdown. Start with the requirements and the two tables in the Question tab.

Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.

You need to log in / sign up to run or submit.
CodePostgreSQL
Sign up free to run your codeLog inLn 1
Run your query to see results here.