Write a SQL query to find the percentage of defects closed within SLA.
Use the defects and sla_policies tables. Evaluate only defects with status Closed and a non-null closing timestamp. Match each defect to its severity policy.
percentage_closed_within_sla.0.00 when no eligible defects exist.| Column | Type | Description |
|---|---|---|
| defect_idPK | INTEGER | Unique defect identifier |
| severity | VARCHAR(50) | Defect severity used to select the SLA policy |
| opened_at | TIMESTAMP | Timestamp when the defect was opened |
| closed_at | TIMESTAMP | Timestamp when the defect was closed |
| status | VARCHAR(20) | Current defect status |
| Column | Type | Description |
|---|---|---|
| severityPK | VARCHAR(50) | Severity covered by the policy |
| sla_hours | NUMERIC(10,2) | Maximum allowed closure time in hours |