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.
site_id, site_name, region, incident_count, employee_hours, incident_rate_per_1000_hours, and rate_rank.site_id ascending.| Column | Type | Description |
|---|---|---|
| incident_idPK | INT | Unique incident identifier |
| site_id | INT | Site associated with the incident |
| incident_date | DATE | Date the incident occurred |
| incident_type | VARCHAR(50) | Classification of the incident |
| severity | VARCHAR(20) | Incident severity classification |
| Column | Type | Description |
|---|---|---|
| site_idPK | INT | Unique site identifier |
| site_name | VARCHAR(100) | Site display name |
| region | VARCHAR(50) | Operational region |
| Column | Type | Description |
|---|---|---|
| staffing_idPK | INT | Unique staffing record identifier |
| site_id | INT | Site associated with the staffing total |
| employee_hours | INT | Total employee-hours for the reporting period |