SOLUTION: finding duration and then average time :))
\n\n# Code\n\n/* Write your T-SQL query statement below */\nwith started_time as (\n    SELECT * FROM Activity WHERE activity_type = \'start\'\n),\nend_time as 
\n\n# Code\n```\n/* Write your T-SQL query statement below */\nwith started_time as (\n    SELECT * FROM Activity WHERE activity_type = \'start\'\n),\nend_time as (\n    SELECT * FROM Activity WHERE activity_type = \'end\'\n)\nSELECT machine_id, ROUND(Avg(duration), 3) as processing_time from (\nselect s.machine_id, s.process_id, e.timestamp - s.timestamp as duration\nfrom started_time as s\ninner join end_time as e ON s.machine_id = e.machine_id and s.process_id = e.process_id) c\nGROUP BY machine_id\n\n```
['MS SQL Server']