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
Analyzing Nursing Data with SQL
00:00
5 left

Analyzing Nursing Data with SQL

HardSQL · PostgreSQL

Problem

Tell me about a time you completed a CMS data case study and used SQL to analyze nursing data.

For this exercise, write a SQL query that analyzes active nursing facilities and their 2024 registered-nurse staffing records. Calculate each facility's valid reporting months and average RN hours per resident day. Treat zero resident days and missing RN hours as invalid measurements.

Output

  1. One row per active facility, including facilities without valid records.
  2. Columns: facility_name, state, months_reported, avg_rn_hours_per_resident_day, and staffing_band.
  3. Classify facilities with at least two valid months and an average of at least 0.030 as Meets benchmark, other facilities with at least two valid months as Below benchmark, and all others as Insufficient data.
  4. Order by state ascending, then facility name ascending.

Schema

nursing_facilities
ColumnTypeDescription
facility_idPKINTUnique nursing facility identifier
facility_nameVARCHAR(100)Facility name
stateVARCHAR(2)Two-letter facility state code
is_activeBOOLEANWhether the facility is currently active
nursing_staffing_monthly
ColumnTypeDescription
staffing_record_idPKINTUnique monthly staffing record identifier
facility_idINTReferenced nursing facility
record_monthDATEFirst day of the reporting month
rn_hoursDECIMAL(10,2)Registered-nurse hours reported for the month
resident_daysINTTotal resident days for the month
Tablesnursing_facilitiesnursing_staffing_monthly
Interviewer

Your question is Analyzing Nursing Data with SQL. 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.