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 Across Tables
00:00
5 left

SQL Joins Across Tables

MediumSQL · PostgreSQL

Problem

Health Catalyst's Population Health workflows need a patient-level list of active patients with currently open care gaps. Write a PostgreSQL query that joins patient, care gap, and outreach action data.

Requirements

  1. Include only active patients with open care gaps due between January 1 and March 31, 2025.
  2. Return the patient name, region, number of distinct open care gaps, number of non-cancelled outreach actions, and most recent action date.
  3. Classify patients with two or more qualifying care gaps as high-touch; classify all others as standard.
  4. Include patients even when they have no qualifying outreach actions, then sort by care gap count descending and patient name ascending.

Schema

patients
ColumnTypeDescription
patient_idPKINTUnique patient identifier
patient_nameVARCHAR(100)Patient display name
regionVARCHAR(50)Care delivery region
is_activeBOOLEANWhether the patient is actively enrolled
enrollment_dateDATEDate the patient entered the program
care_gaps
ColumnTypeDescription
gap_idPKINTUnique care gap identifier
patient_idINTPatient associated with the gap
gap_typeVARCHAR(50)Clinical or preventive care gap type
statusVARCHAR(20)Current gap status
due_dateDATEDate by which the gap should be addressed
priorityVARCHAR(20)Operational priority
outreach_actions
ColumnTypeDescription
action_idPKINTUnique outreach action identifier
gap_idINTCare gap targeted by the action
action_statusVARCHAR(20)Status of the outreach action
action_dateDATEDate the action occurred
action_noteVARCHAR(200)Brief operational note
Tablespatientscare_gapsoutreach_actions
Interviewer

Your question is SQL Joins Across Tables. 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.