I need to create a mapping between existing job positions and new job positions. Unfortunately, there is no mapping between the new / old position. Hence, I thought I could lookup between the Activities and the one with the best fit would be the right one.

Background:

Im running an MySQL DB with five tables, Table A is listing all the employees. Table B shows all the positions with a type wheter it is a new or an old position. Table C lists all existing activities. Table D & E are mapping between Position <-> Activities and Employee <-> Position (old), but I dont have a mapping between the old and new positions.

I have following tables:

TABLE A (Employee, Name)
TABLE B (Position, Description, Type (new/old) )
TABLE C (Activities, Description)
TABLE D (Position, Activities)
TABLE E (Employee, Position)

As a final outcome, I need to create a list with the Employee to new position mapping. Dont know if this is possible with SQL only as i guess it needs to loop to find the best matching new position

EDIT: The expected result for the Employees (John Doe, Celine Dion) is to get the ITSM role (with Type N) as there is ab better match (two Activities) than ITPM as it matches only by one Activity

CREATE OR REPLACE TABLE r2e.Employee
(
    fUID Char(15),
    fName Char (255),
    PRIMARY KEY(fUID)
);

CREATE OR REPLACE TABLE r2e.Position
(
    fPosition Char (15),
    fPDescription Char (255),
    fPType Char(1),
    PRIMARY KEY(fPosition)
);

CREATE OR REPLACE TABLE r2e.Activities
(
    fActivity Char(15),
    fADescription Char (255),
    PRIMARY KEY(fActivity)
);

CREATE OR REPLACE TABLE r2e.P2A
(
    fPosition Char(15),
    fActivity Char (15),
    PRIMARY KEY(fPosition,fActivity)
);

CREATE OR REPLACE TABLE r2e.E2P
(
    fUID Char(15),
    fPosition Char (15),
    PRIMARY KEY(fUID,fPosition)
Previous post The evolution of iot connectivity landscape
Next post Things To Keep In Mind When Buying Glasses For Computer Work