PostgreSQL: Aggregate Work Hours by Employee and Day
IntuitionApproachinvolves using a postgreSQL query to calculate the total time worked by each employee on each day. I select the event_day, emp_id, and compute
# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->

# Approach
involves using a postgreSQL query to calculate the total time worked by each employee on each day. I select the event_day, emp_id, and compute the total time by subtracting in_time from out_time. Then, I group the results by emp_id and event_day to get the sum of worked hours for each combination.

# Complexity
- Time complexity:
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

- Space complexity:
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

# Code
```postgresql []
-- Write your PostgreSQL query statement below
SELECT 
    event_day AS day,
    emp_id,
    SUM(out_time - in_time) AS total_time
FROM 
    Employees
GROUP BY 
    emp_id, event_day;
```
['PostgreSQL']