I’m working with a SQL database for a Skills Matrix application and I need a query to return a list of employees that are qualified for a given position. Here’s a brief overview of the relevant relationships:
- Employee has many skills through
qualifications - Position has many
skills through requirements
Is there a efficient way to return a list of employees that have the qualifications to meet a certain position’s requirements?
EDIT
employees
- id
- name
positions
- id
- title
skills
- id
- name
requirements
- position_id
- skill_id
qualifications
- employee_id
- skill_id
It will find all employees such that there are no requirement that is not filled by the employee’s qualifications.
The use of nested
NOT EXISTSis even mentioned in the MySQL Reference Maual