Write a SQL query to compare monthly part failure rates across depots and rank the depots by failure rate within each month.
Use the depots and monthly_part_stats tables. Include only records with a positive inspected-parts count and a non-null failure count.
month_start, depot_name, failure_rate, and depot_rankfailure_rate is the percentage of inspected parts that failed, rounded to two decimals| Column | Type | Description |
|---|---|---|
| depot_idPK | INT | Unique depot identifier |
| depot_name | VARCHAR(100) | Depot display name |
| region | VARCHAR(50) | Geographic operating region |
| Column | Type | Description |
|---|---|---|
| stat_idPK | INT | Unique monthly statistics record |
| depot_id | INT | Referenced depot |
| month_start | DATE | First day of the reporting month |
| parts_inspected | INT | Number of parts inspected during the month |
| failed_parts | INT | Number of inspected parts that failed |