select avg(time_to_sec(timediff(tempo2,tempo1))) as media from tabella