+1 for a response from @Rahul, another alternative is to create an attribute in the employee table. Although I would not use BIT, because there are errors in this data type. Just use BOOLEAN or TINYINT.
But the way you have it, creating a second table has the following advantage: medical_employees_competences implicitly limited to referring only to medical professionals. He cannot refer to someone if they are not in this table.
Another way to provide this restriction is to make the foreign key as follows:
CREATE TABLE employees ( id INT PRIMARY KEY AUTO_INCREMENT, name VARCHAR(100) NOT NULL IsMedical BOOLEAN DEFAULT 0, KEY (id, IsMedical) ); CREATE TABLE medical_employees_competences ( id INT PRIMARY KEY AUTO_INCREMENT, IsMedical BOOLEAN DEFAULT 1, medic_id INT NOT NULL, competence_id INT NOT NULL, FOREIGN KEY (medic_id, IsMedical) REFERENCES medical_employees(id, IsMedical), FOREIGN KEY (competence_id) REFERENCES medical_competences(id) );
Now you can achieve the same limitation that you can only refer to healthcare providers using the second table.
source share