문제요약
각 머신의 끝-시작의 시간을 구한뒤 각 머신의 process_id의 횟수만큼 나눈다.
포인트
셀프조인, 그룹바이
select * from Activity a inner join Activity b
on a.machine_id=b.machine_id
and a.process_id = b.process_id
and a.timestamp < b.timestamp
답
select a.machine_id, round(avg(b.timestamp-a.timestamp),3) as processing_time from Activity a inner join Activity b
on a.machine_id=b.machine_id
and a.process_id = b.process_id
and a.timestamp < b.timestamp
group by a.machine_id
order by a.machine_id