Skip to main content

Overstretched Employees

HardPremium

Given the schema shown below, write a solution to identify if there are any employees that are on multiple projects happening at the same time.

employees projects +---------------+---------+ +---------------+---------+ | id | int |<----+ +->| id | int | | first_name | varchar | | | | title | varchar | | last_name | varchar | | | | start_date | date | | salary | int | | | | end_date | date | | department_id | int |--+ | | | budget | int | +---------------+---------+ | | | +---------------+---------+ | | | departments | | | employees_projects +---------------+---------+ | | | +---------------+---------+ | id | int |<-+ | +--| project_id | int | | name | varchar | +-----| employee_id | int | +---------------+---------+ +---------------+---------+

Your function should return a result in the following format:

department_name | employee_id | first_name | last_name | project_at_risk ----------------+-------------+------------+-----------+---------------- varchar | int | varchar | varchar | varchar (title)

The project at risk is the project that starts later among the two (or more projects) that an employee is working on at that time.