Beats > 97%. 250 IQ SOLUTION - MS SQL SERVER
Intuition\nnone\n\n# Approach\nJust use your brain lmao\n\n# Complexity\n- Time complexity:\nO(n^100000!)\n\n- Space complexity:\nO(n^100000!)\n\n# Code\n\n/* W
# Intuition\nnone\n\n# Approach\nJust use your brain lmao\n\n# Complexity\n- Time complexity:\nO(n^100000!)\n\n- Space complexity:\nO(n^100000!)\n\n# Code\n```\n/* Write your T-SQL query statement below */\nwith temp as(\nselect a1.machine_id, a1.process_id, a1.timestamp as start_time, a2.timestamp as end_time\nfrom activity a1\njoin activity a2 on a1.machine_id = a2.machine_id and a1.process_id = a2.process_id\nwhere a1.activity_type = \'start\' and a2.activity_type = \'end\')\n\nselect machine_id, round(avg(end_time - start_time),3) as processing_time\nfrom temp\ngroup by machine_id\norder by machine_id desc\n```
['MS SQL Server']