Interview Query

Unique Work Days

1
Have you seen this question before?

You have a table containing information about the projects employees have worked on and the time period in which they worked on the project. Each project can be assigned to more than one employee, and an employee can be working on more than one project at a time.

Write a query to find how many unique days each employee worked. Order your query by the employee_id.

Example:

Input:

projects table

Columns Type
id INTEGER
title VARCHAR
start_date DATETIME
end_date DATETIME
budget INTEGER
employee_id INTEGER

Output:

Columns Type
employee_id INTEGER
days_worked DATETIME
Next question: How Many Friends
.....
MySQL 8.0.17
Loading editor
Use Shift + Enter to run query