Easy Solution using subquery
\n# Approach\n Describe your approach to solving the problem. \nMake a subquery which will extract start and end points for every process in every machine using
\n# Approach\n<!-- Describe your approach to solving the problem. -->\nMake a subquery which will extract start and end points for every process in every machine using group by machine_id and process_id. Then goes an easy part. We just selct avg of end-start over our subquery and using group by machide_id. \n\n# Code\n```\n# Write your MySQL query statement below\n\nselect machine_id, round(avg(end-start), 3) as processing_time\n\nfrom (select machine_id, process_id ,max(timestamp) as end, min(timestamp) as start from Activity group by machine_id, process_id) as a \ngroup by machine_id;\n```
['MySQL']