title: Insert data into two table with Foreign key dependencies
body: <p>How to insert data into two tables in same database which has foreign key dependencies on each other. Here i need to insert data into product table but it fails since it is referencing a column in sku table(which has no data). The second query inserts data to sku table where a <code>DEFAULT_PRODUCT_ID</code> column entry references a product table entry which also has no data. So How can i insert the data and make reference to each other column in both product and sku table? </p>
  
  <p><strong>Error:</strong></p>
  
  <blockquote>
    <p>Cannot add or update a child row: a foreign key constraint fails
    (<code>sodifkj</code>.<code>sku</code>,  CONSTRAINT <code>FK28E82CF77E555D75</code> FOREIGN KEY
    (<code>DEFAULT_PRODUCT_ID</code>) REFERENCES <code>product</code> (<code>PRODUCT_ID</code>))</p>
  </blockquote>
  
  <p><strong>Query:</strong></p>
  
  <pre><code>-- insert into product
  INSERT INTO `product` 
  (`PRODUCT_ID`, `ARCHIVED`, `DISPLAY_TEMPLATE`, `IS_FEATURED_PRODUCT`, `MANUFACTURE`, `MODEL`, `URL`, `URL_KEY`, `DEFAULT_CATEGORY_ID`, `DEFAULT_SKU_ID`, `SIGNATURE_TYPE_ID`, `CAN_SELL_WITHOUT_OPTIONS`, `TAX_CODE`) 
  VALUES ('130', 'N', NULL, '\0', NULL, NULL, '/sig/Persl171', NULL, '4', '1030', 'FREE', NULL, NULL);
  </code></pre>
  
  <p><br></p>
  
  <pre><code>-- insert sku
  INSERT INTO `sku` (`SKU_ID`, `ACTIVE_END_DATE`, `ACTIVE_START_DATE`, `AVAILABLE_FLAG`, `DESCRIPTION`, `CONTAINER_SHAPE`, `DEPTH`, `DIMENSION_UNIT_OF_MEASURE`, `GIRTH`, `HEIGHT`, `CONTAINER_SIZE`, `WIDTH`, `DISCOUNTABLE_FLAG`, `IS_MACHINE_SORTABLE`, `LONG_DESCRIPTION`, `NAME`, `RETAIL_PRICE`, `SALE_PRICE`, `TAXABLE_FLAG`, `WEIGHT`, `WEIGHT_UNIT_OF_MEASURE`, `FULFILLMENT_TYPE`, `INVENTORY_TYPE`, `TAX_CODE`, `CURRENCY_CODE`, `DEFAULT_PRODUCT_ID`) 
  VALUES 
  ('1030', NULL, '2013-02-20 01:00:00', 'N', 'Person171', NULL, NULL, NULL, NULL, '80', NULL, '65', 'N', '0', 'Person171', 'Person171', '0000', '0000', 'N', NULL, NULL, NULL, NULL, NULL, NULL, '130');
  </code></pre>
  
  <p>I tried to run this query between a transaction and if success commit. But this din't work.</p>
  
  <pre><code>START TRANSACTION;
  INSERT INTO product..
  INSERT INTO sku..
  COMMIT
  </code></pre>