title: Database table id-key Null value and referential integrity
body: <p>I'm learning databases, using SQLce. Got some problems, with this error: </p>
  
  <pre><code>A foreign key value cannot be inserted because a corresponding primary key value does not exist. 
  </code></pre>
  
  <p>How does the integrity and acceptance of data work when attempting to save a data row that does not have specified one foreign key. Isn't it possible to set it to NULL in some way, meaning it will not reference the other table? In case, how would I do that? (For an integer key field)</p>
  
  <p>Also, what if you save a row with a valid foreign key that corresponds to an existing primary key in other table. But then decide to delete that entry in this other table. So the foreign key will no longer be valid. Will I be allowed to delete? How does it work?  I would think it should then be simply reset to a null value.. But maybe it's not that simple? </p>