title: Best way to ensure referential integrity
body: <p>I'm a SQL noob, and whilst I'm aware of the major tools available, I'm not experienced enough to know the best tool for certain situations.</p>
  
  <p>As an example, I current have a group of tables where referential integrity is needed. Each table does not have all the necessary columns itself to be able to constrain the data, so I have at least 3 options open to me.</p>
  
  <ol>
  <li><p>Create other table/tables that connect the data together - apart from duplicated data, this leaves multiple files to keep synced.</p></li>
  <li><p>Create a trigger - not too difficult, but how trustworthy is a trigger? And  is it scalable?</p></li>
  <li><p>Create a function - not something I've done before, but I came across an example showing how it could be used to constrain data stored across multiple tables.</p></li>
  </ol>
  
  <p>Given what I'm trying to do - maintain integrity by joining data, what should I consider, and are all 3 methods suited to what I'm trying to do?</p>
  
  <p>Here an example using a bridge table to link missing table:</p>
  
  <p><img src="https://i.stack.imgur.com/7uTeC.gif" alt="enter image description here"></p>