How it should be (99.32%: 326 ms): Two sub q.
Complexity\n- Time complexity: 99.32%\n Add your time complexity here, e.g. O(n) \n\n# Code\n\nSELECT a.machine_id, ROUND(AVG(a.timestamp - b.timestamp ),3)AS p
# Complexity\n- Time complexity: 99.32%\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nSELECT a.machine_id, ROUND(AVG(a.timestamp - b.timestamp ),3)AS processing_time\nFROM (SELECT * FROM Activity WHERE activity_type = \'end\') AS a\nLEFT JOIN (SELECT * FROM Activity WHERE activity_type = \'start\') AS b\nON a.machine_id = b.machine_id\nGROUP BY a.machine_id;\n```
['MySQL']