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