title: Artificial Intelligence using sql query/stored procedure
body: <p>I'm making an application that should organize employees to jobs.</p>
  
  <p>One employee can't be in two jobs simultaneously.<br>
  Every employee has one or more qualifications.<br>
  Every job has one or more qualifications required for the job.<br>
  * All of the jobs should be staffed.</p>
  
  <p>These are the tables:<br>
  1. Employees table - every person has PID number.<br>
  2. Qualifications table - [Id, Name].<br>
  3. QualificationsOfEmployee - every person can have more than one qualification [PID, QualificationId].<br>
  4. Jobs [Id, Name, NumOfEmployee(how much people is needed for job)]<br>
  5. QualificationsRequireForJob table - [JobId, QualificationId]  </p>
  
  <p>Now, I would like to make a query/function to find a qualified employee/s (depend on Jobs.NumOfEmployee) for every job.
  The trick is that there is probably more than one qualified employee for every job, but some of them are maybe needed to other jobs (cause they have many qualifications).</p>
  
  <p>I don't think a simple sql join or a sub-query could do the work.<br>
  Are there any ideas?</p>
  
  <p>Thanks a lot,
  Elad</p>