# Write your MySQL query statement below
select a1.machine_id,round(avg(a2.timestamp-a1.timestamp),3) as processing_time
from Activity as a1 join Activity as a2
on a1.machine_id=a2.machine_id and a1.process_id=a2.process_id and a1.activity_type = 'start' and a2.activity_type='end'
group by machine_id;
知识点1:要对自己的表做前后列的操作,最好是自连接,做笛卡尔积
知识点2:round(...,x)函数,保留几位小数
知识点3:avg()函数,求平均值
知识点4:学会用 group by分组