I have two tables:
EMPLOYEE
Name | DepartmentId | Address | Phone number
--------------------------------------------
Tom | [a1, b2] | 51 Rue Fort | 123456
Ron | [a1] | San Picafort | 234566
Matt | [b2] | Frank Road | 523422
DEPARTMENT
Id | Dept Name | Number of Employees | Location
------------------------------------------
a1 | HR | 500 | Zambia
b2 | IT | 300 | Tanzania
I need to join two tables on DepartmentId, but the problem is DepartmentId in EMPLOYEE table is an array. I cannot run join on it. Like:
select *
from EMPLOYEE,
DEPARTMENT
where EMPLOYEE.DepartmentId = DEPARTMENT.id;
Which will give output like:
Name | DepartmentId | Address | Phone number | Dept Name | Number of Employees | Location
---------------------------------------------------------------------
Tom | a1 | 51 Rue Fort | 123456 | HR | 500 | Zambia
Tom | b2 | 51 Rue Fort | 123456 | IT | 300 | Tanzania
Ron | a1 | San Picafort | 234566 | HR | 500 | Zambia
Matt | b2 | Frank Road | 523422 | IT | 300 | Tanzania
How can I make EMPLOYEE table atomic using a query and then run a join query?