Employees at Microsoft can belong to multiple departments. When an employee is in multiple departments, they must choose one as their primary department, marked with a flag Y. If an employee belongs to only one department, that department is their primary department by default.
Write an SQL query to report all the employees with their primary department.
| employee_id(INTEGER) | department_id(INTEGER) | primary_flag(ENUM('Y', 'N')) |
|---|---|---|
| 1 | 1 | N |
| 2 | 1 | N |
| 2 | 2 | Y |
| 3 | 3 | N |
| 4 | 2 | N |
| 4 | 3 | Y |
| 4 | 4 | N |
| employee_id(INTEGER) | department_id(INTEGER) |
|---|---|
| 1 | 1 |
| 2 | 2 |
| 3 | 3 |
| 4 | 3 |