Write a SQL query to identify the top three manufacturing steps with the highest failure rates over the last thirty days.
Use completed_at to define the thirty-day period. Calculate each step's failure rate as failed runs divided by all runs for that step.
step_name, total_runs, failed_runs, and failure_rate_pct.| Column | Type | Description |
|---|---|---|
| step_idPK | INT | Unique identifier for a manufacturing step |
| step_name | VARCHAR(100) | Name of the manufacturing step |
| Column | Type | Description |
|---|---|---|
| run_idPK | INT | Unique identifier for a process run |
| step_id | INT | Manufacturing step associated with the run |
| completed_at | TIMESTAMP | Timestamp when the run completed |
| outcome | VARCHAR(20) | Run outcome, such as PASSED or FAILED |