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
SQL Joins, Procedures, and Pipelines
00:00
5 left

SQL Joins, Procedures, and Pipelines

HardSQL · PostgreSQL

Problem

Explain how you use SQL joins and stored procedures to transform data in a pipeline, and describe how you validate the results end to end.

Use the provided PostgreSQL tables to implement a refresh procedure for the case summary table. Include all source cases, calculate event metrics, resolve the latest assignment and event, and account for cases without matching records.

Output

  1. Return one row per source case with case_id, customer_ref, team, priority, event_count, total_handle_minutes, latest_status, and first_response_minutes.
  2. Include cases without events or assignments, use Unassigned where the current team is unavailable, and order by total_handle_minutes descending, then case_id ascending.

Schema

source_cases
ColumnTypeDescription
case_idPKINTUnique case identifier
customer_refVARCHAR(10)Customer reference
priorityVARCHAR(10)Case priority
opened_atTIMESTAMPTimestamp when the case was opened
case_events
ColumnTypeDescription
event_idPKINTUnique event identifier
case_idINTReferenced case
statusVARCHAR(20)Status after the event
event_tsTIMESTAMPEvent timestamp
event_typeVARCHAR(20)Type of case event
handle_minutesNUMERIC(10,2)Handling time attributed to the event
case_assignments
ColumnTypeDescription
assignment_idPKINTUnique assignment identifier
case_idINTReferenced case
teamVARCHAR(30)Assigned Sutherland support team
effective_atTIMESTAMPTime the assignment became effective
pipeline_case_summary
ColumnTypeDescription
case_idPKINTSource case identifier
customer_refVARCHAR(10)Customer reference copied from the source
teamVARCHAR(30)Current team or Unassigned
priorityVARCHAR(10)Case priority
event_countINTNumber of events for the case
total_handle_minutesNUMERIC(10,2)Total event handling time
latest_statusVARCHAR(20)Status from the latest event
first_response_minutesNUMERIC(10,2)Minutes from opening to first response
Tablessource_casescase_eventscase_assignmentspipeline_case_summary
Interviewer

Your question is SQL Joins, Procedures, and Pipelines. Start with the requirements and the four 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.