title: Query where NOT NULL but only if NOT used as a FK
body: <pre><code>area
  -----
  id           BIGSERIAL PRIMARY KEY
  deleted_at   TIMESTAMP WITH TIME ZONE   DEFAULT NULL
  </code></pre>
  
  <p>and </p>
  
  <pre><code>registration
  -----
  area_id   BIGINT   REFERENCES area(id) NOT NULL
  </code></pre>
  
  <p>I want to get all records from <code>area</code> which have <code>deleted_at IS NULL</code> and the ones that can have <code>deleted_at is NOT NULL</code> <strong>but</strong> are present as a FK in the <code>registration</code>.</p>
  
  <pre><code>SELECT * FROM area
    JOIN registration AS reg 
      ON reg.area_id=area.id
   WHERE area.deleted_at IS NULL;
  </code></pre>
  
  <p>will omit the <code>area</code> records which are FKs in <code>registration</code> but have been marked as "deleted".</p>
  
  <p>Adding an <code>AND</code> clause regarding the <code>deleted_at</code> column in the <code>JOIN ON</code> clause doesn't make sense, since it will only strip out valid records.</p>
  
  <p>I can't quite wrap it around my head, since the two <code>where</code> conditions kind of contradict each other.</p>