select department,concat(round(sum(time)/count(time)*100,1),'%') ratio from( select department, case when date_add(date_add(first_clockin,interval 9 hour),interval 30 minute)<last_clockin then 1 else 0 end time from attendent_tb join staff_tb on attendent_tb.staff_id=staff_tb.staff_id)jb group by...