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
ExperiencesCoaching
New
Practice
Mock InterviewsTimed interview simulations with feedbackSuccess 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
Get started
Find Latest Failed Step per Pipeline
00:00
5 left

Find Latest Failed Step per Pipeline

MediumSQL · PostgreSQL

Problem

Explain how you would handle an error in your data transformation pipeline for Citi's data workflows.

Use the tables below to identify the most recent failed step for each pipeline. If a pipeline has no failed steps, it should not appear in the result.

Output

  1. One row per pipeline with at least one failed step
  2. Columns: pipeline_name, latest_failed_step, failed_at, error_code
  3. Return the most recent failure per pipeline, ordered by failed_at descending, then pipeline_name ascending
  4. Ignore rows where failed_at is NULL

Output details

  • When failed timestamps tie within a pipeline, select the row with the greatest step_id.

Schema

pipelines
ColumnTypeDescription
pipeline_idPKINTUnique pipeline identifier
pipeline_nameVARCHAR(100)Pipeline name
owner_teamVARCHAR(100)Team responsible for the pipeline
pipeline_steps
ColumnTypeDescription
step_idPKINTUnique step record identifier
pipeline_idINTPipeline identifier
step_nameVARCHAR(100)Transformation step name
statusVARCHAR(20)Execution status such as SUCCEEDED or FAILED
failed_atTIMESTAMPTimestamp when the step failed
error_codeVARCHAR(20)Failure code returned by the workflow
Tablespipelinespipeline_steps
Interviewer

Your question is Find Latest Failed Step per Pipeline. 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.