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
Efficient Telemetry Aggregation Query
00:00
5 left

Efficient Telemetry Aggregation Query

MediumSQL · PostgreSQL

Problem

Caterpillar's fleet monitoring system needs a daily summary of telemetry for active machines operating at North American sites. Write a PostgreSQL query that aggregates readings while preserving active machines that have no telemetry during the reporting period.

Requirements

  1. Include active machines at sites where region = 'North America' for January 1 through January 3, 2026.
  2. Return one row per machine and telemetry date with reading count, average engine temperature, and maximum fuel rate.
  3. Preserve machines without readings using LEFT JOIN, and label each row as NO DATA, UNAVAILABLE, HIGH, ELEVATED, or NORMAL based on the aggregated temperature.
  4. Order the result by machine ID and telemetry date, with machines without readings included at the end of their machine group.

Schema

cat_sites
ColumnTypeDescription
site_idPKINTUnique Caterpillar operating or test site identifier
site_nameVARCHAR(120)Name of the operating or test site
regionVARCHAR(40)Geographic region used for reporting
cat_machines
ColumnTypeDescription
machine_idPKINTUnique machine identifier
modelVARCHAR(40)Caterpillar machine model
site_idINTOperating site reference
statusVARCHAR(20)Current machine lifecycle status
telemetry_readings
ColumnTypeDescription
reading_idPKINTUnique telemetry reading identifier
machine_idINTMachine that emitted the reading
reading_atTIMESTAMPTimestamp when the reading was captured
engine_temp_cDECIMAL(6,2)Engine temperature in degrees Celsius
fuel_rate_lphDECIMAL(8,2)Fuel consumption rate in liters per hour
Tablescat_sitescat_machinestelemetry_readings
Interviewer

Your question is Efficient Telemetry Aggregation Query. Start with the requirements and the three 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.