From 5d2576510934bb5d71715213e9ef0bb4719f7876 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Antonio=20Chac=C3=B3n=20Guti=C3=A9rrez?= <138903866+joseantoniochacon@users.noreply.github.com> Date: Sat, 1 Jun 2024 11:00:13 -0600 Subject: [PATCH] Time: 637 ms (14.41%), Space: 0B (100.00%) - LeetHub --- .../1661-average-time-of-process-per-machine.sql | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 1661-average-time-of-process-per-machine/1661-average-time-of-process-per-machine.sql diff --git a/1661-average-time-of-process-per-machine/1661-average-time-of-process-per-machine.sql b/1661-average-time-of-process-per-machine/1661-average-time-of-process-per-machine.sql new file mode 100644 index 0000000..acb19de --- /dev/null +++ b/1661-average-time-of-process-per-machine/1661-average-time-of-process-per-machine.sql @@ -0,0 +1,2 @@ +# Write your MySQL query statement below +SELECT DISTINCT machine_id, ROUND((SELECT AVG(timestamp) FROM Activity a2 WHERE a2.machine_id = a1.machine_id AND activity_type = 'end')-(SELECT AVG(timestamp) FROM Activity a2 WHERE a2.machine_id = a1.machine_id AND activity_type = 'start'),3) AS processing_time FROM Activity a1; \ No newline at end of file