title: Can MySQL enforce global WHERE clauses and/or do they exist?
body: <p>I think I know the answer to this, but I want to ask the community anyways.</p>
  
  <p>Imagine two tables:</p>
  
  <p>TableA</p>
  
  <pre><code>ID    |    Col1    |    isActive
  1       "Some Data1"     1
  2       "Some Data2"     1
  3       "Some Data3"     0
  4       "Some Data4"     1
  </code></pre>
  
  <p>TableB</p>
  
  <pre><code>ID    |    TableA_ID    |    isActive
  1          1                 1
  4          1                 1
  7          3                 1
  8          4                 1
  </code></pre>
  
  <p>And the following query:</p>
  
  <pre><code>SELECT A.COL1
  FROM TableB as B
  JOIN TableA as A
    ON A.ID = B.TableA_ID
  WHERE b.ID in (1,4,7);
  </code></pre>
  
  <p>That will return these results:</p>
  
  <pre><code>    Col1
  "Some Data1"
  "Some Data1"
  "Some Data3"
  </code></pre>
  
  <p>But what I want is:</p>
  
  <pre><code>    Col1
  "Some Data1"
  "Some Data1"
  </code></pre>
  
  <p>I don't want to add a "WHERE isActive = 1" condition to every join and every where clause. Like so many others, we don't like the idea of deleting records. But, it is sooo tedious and repetitive to add "WHERE isActive = 1" to every query.</p>
  
  <p>So the question is:</p>
  
  <p>Can I enforce this sort of "global condition" on all queries made to my database? Has anyone else ever wondered about this?</p>