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
Automating Reporting with SQL/Python
00:00
5 left

Automating Reporting with SQL/Python

MediumSQL · PostgreSQL

Problem

How have you utilized SQL or Python to automate repetitive data extraction or reporting tasks?

For this hands-on version, demonstrate the SQL portion by producing a recurring monthly report from the provided program and work-log data. Include active programs even when they have no qualifying work logs.

Output

  1. One row per active program for January 2025
  2. Columns: program_id, program_name, report_owner, total_approved_hours, approved_entries, and active_log_days
  3. Include only approved logs dated from January 1 through January 31, 2025; show zero totals where no qualifying logs exist
  4. Order by total_approved_hours descending, then program_id ascending

Schema

programs
ColumnTypeDescription
program_idPKINTUnique program identifier
program_nameVARCHAR(100)Program name
statusVARCHAR(20)Current program status
report_ownerVARCHAR(100)Person responsible for the report
work_logs
ColumnTypeDescription
log_idPKINTUnique work-log identifier
program_idINTReferenced program identifier
work_dateDATEDate on which work was recorded
hoursNUMERIC(8,2)Hours recorded for the work log
entry_statusVARCHAR(20)Approval status of the work log
Tablesprogramswork_logs
Interviewer

Your question is Automating Reporting with SQL/Python. 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.