Operational efficiency at a data center is measured by how quickly machines complete assigned tasks. Each machine runs multiple processes, and each process has a start and end timestamp.
Write an SQL query to find the average time each machine takes to complete a process.
| machine_id(INTEGER) | process_id(INTEGER) | activity_type(ENUM('start', 'end')) | timestamp(FLOAT) |
|---|---|---|---|
| 0 | 0 | start | 0.712 |
| 0 | 0 | end | 1.52 |
| 0 | 1 | start | 3.14 |
| 0 | 1 | end | 4.12 |
| 1 | 0 | start | 0.55 |
| 1 | 0 | end | 1.55 |
| 1 | 1 | start | 0.43 |
| 1 | 1 | end | 1.42 |
| 2 | 0 | start | 4.1 |
| 2 | 0 | end | 4.512 |
| 2 | 1 | start | 2.5 |
| 2 | 1 | end | 5 |
| machine_id(INTEGER) | processing_time(FLOAT) |
|---|---|
| 0 | 0.894 |
| 1 | 0.995 |
| 2 | 1.456 |