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 and Date Aggregation
00:00
5 left

SQL Joins and Date Aggregation

MediumSQL · PostgreSQL

Problem

Agile Defense's mission support dashboard needs a daily summary of operational events across missions and monitored systems. Write a PostgreSQL query that joins mission events to their mission and system records, then aggregates the results by event date and mission.

Requirements

  1. Restrict results to events from April 1 through April 4, 2025, inclusive.
  2. Return the event date, mission code, mission name, total event count, completed event count, distinct systems involved, and total impact score.
  3. Use a LEFT JOIN for systems so events remain visible when a system record is unavailable. Treat a missing impact score as zero.
  4. Return only date and mission groups with more than one event, ordered by date and mission code.

Schema

missions
ColumnTypeDescription
mission_idPKINTEGERPrimary key for a mission
mission_codeVARCHAR(20)Short mission identifier
mission_nameVARCHAR(100)Mission display name
mission_events
ColumnTypeDescription
event_idPKINTEGERPrimary key for an event
mission_idINTEGERReferences missions.mission_id
system_idINTEGERReferences systems.system_id when available
event_recorded_atTIMESTAMPTimestamp when the event was recorded
statusVARCHAR(20)Current event status
impact_scoreINTEGERNumeric impact score
systems
ColumnTypeDescription
system_idPKINTEGERPrimary key for a monitored system
system_nameVARCHAR(100)System display name
system_categoryVARCHAR(50)System classification
Tablesmissionsmission_eventssystems
Interviewer

Your question is SQL Joins and Date Aggregation. 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.