title: Foreign key in mysql table- is the presence of target data necessary?
body: <p>I have 2 tables</p>
  
  <p>TableA(id_A, name_A, info_A)</p>
  
  <p>tableB(id_B, A_id, some_data) foreign key(A_id) references tableA(id_A)</p>
  
  <p>So when I insert a row in B, with value XXX as value in the second column id_A, is it necessary that the table_A should have a row with XXX as id?</p>
  
  <p>If not, then what constraint should i lay upon the tables so that table B references only a table_A row that is present?</p>