Leetcode Note: MySQL - Find Total Time Spent by Each Employee

Find Total Time Spent by Each Employee - LeetCode
https://leetcode.com/problems/find-total-time-spent-by-each-employee/

  • MySQL で取り組んだメモ

回答

[MySolution] Group By, Two Approaches, Performance Compare - Find Total Time Spent by Each Employee - LeetCode
https://leetcode.com/problems/find-total-time-spent-by-each-employee/solutions/1086265/mysolution-group-by-two-approaches-performance-compare/

select
    event_day as day, emp_id
    , sum(out_time) - sum(in_time) as total_time
from 
    Employees
group by 
    event_day, emp_id