Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
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 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
Build my plan
SQL for Operational KPI Tracking
00:00
5 left

SQL for Operational KPI Tracking

HardSQL · PostgreSQL

Problem

Write a SQL query to track monthly operational KPIs by region at the United Nations, including joins across program, finance, and staffing tables, and calculate month-over-month changes.

Use the supplied tables and include data from January through March 2025.

Output

  1. One row per region and month, with region, month_start, program_count, total_expenditure_usd, total_active_staff, expenditure_mom_change_pct, and staff_mom_change_pct.
  2. Include all regions with finance records in the period. Return NULL for a percentage change when there is no prior value or the prior value is zero.
  3. Order by region, then month_start ascending.

Schema

programs
ColumnTypeDescription
program_idPKINTUnique program identifier
program_nameVARCHAR(150)United Nations program name
regionVARCHAR(80)Operational region
finance_monthly
ColumnTypeDescription
finance_idPKINTUnique finance record identifier
program_idINTRelated program identifier
month_startDATEFirst day of the reporting month
expenditure_usdNUMERIC(14,2)Monthly expenditure in US dollars
staffing_monthly
ColumnTypeDescription
staffing_idPKINTUnique staffing record identifier
program_idINTRelated program identifier
month_startDATEFirst day of the reporting month
active_staffINTActive staff count for the month
Tablesprogramsfinance_monthlystaffing_monthly
Interviewer

Your question is SQL for Operational KPI Tracking. 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.