title: Adding constraint to a table referencing a subset of records of another table
body: <p>Say I have the following tables:</p>
  
  <pre><code>User(user_id, name, age,...)
  Job(job_id, salary, user_id)
  </code></pre>
  
  <p>I want to have a constraint on <code>Job</code> so that whenever the job's salary is > 20,000, the user doing the job must be of age >= 18. I have tried the <code>CHECK</code> constraint but it seems to work on single table only?</p>