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 Incident Rate per 1,000
00:00
5 left

SQL Incident Rate per 1,000

HardSQL · PostgreSQL

Problem

Write a SQL query to join incident logs, site metadata, and staffing tables to identify sites with the highest incident rate per 1,000 employee-hours.

Calculate the rate using all incidents and positive employee-hours. Return every site tied for the highest rate.

Output

  1. One row per highest-rate site, with site_id, site_name, region, incident_count, employee_hours, incident_rate_per_1000_hours, and rate_rank.
  2. Sort by site_id ascending.

Schema

incident_logs
ColumnTypeDescription
incident_idPKINTUnique incident identifier
site_idINTSite associated with the incident
incident_dateDATEDate the incident occurred
incident_typeVARCHAR(50)Classification of the incident
severityVARCHAR(20)Incident severity classification
site_metadata
ColumnTypeDescription
site_idPKINTUnique site identifier
site_nameVARCHAR(100)Site display name
regionVARCHAR(50)Operational region
staffing
ColumnTypeDescription
staffing_idPKINTUnique staffing record identifier
site_idINTSite associated with the staffing total
employee_hoursINTTotal employee-hours for the reporting period
Tablesincident_logssite_metadatastaffing
Interviewer

Your question is SQL Incident Rate per 1,000. 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.