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 Top Entities by Negative Outcome
00:00
5 left

SQL Top Entities by Negative Outcome

MediumSQL · PostgreSQL

Problem

athenahealth uses encounter and outcome data to monitor operational performance across providers. Write a PostgreSQL query to identify the providers with the highest rate of negative encounter outcomes during the last completed calendar quarter.

Treat DENIED and DELAYED outcomes as negative. The rate is negative outcomes divided by all qualifying encounters, including encounters with no recorded outcome.

Requirements

  1. Filter encounters to the last completed calendar quarter based on the current date.
  2. Calculate total encounters, negative outcomes, and the negative outcome rate for each provider.
  3. Return the top five providers, ordered by negative outcome rate descending. Break ties with total encounters descending, then provider_id ascending.
  4. Exclude providers with no qualifying encounters.

Schema

providers
ColumnTypeDescription
provider_idPKINTUnique provider identifier
provider_nameVARCHAR(100)Provider display name
encounters
ColumnTypeDescription
encounter_idPKINTUnique encounter identifier
provider_idINTProvider associated with the encounter
encounter_dateDATEDate the encounter occurred
encounter_outcomes
ColumnTypeDescription
encounter_idPKINTEncounter associated with the outcome
outcome_statusVARCHAR(20)Recorded encounter outcome status
Tablesprovidersencountersencounter_outcomes
Interviewer

Your question is SQL Top Entities by Negative Outcome. 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.