title: Compare 2 MYSQL Tables and depending on the conditions either insert or update - 1 million record
body: <p>Here is Mysql tables <code>dumpdata_temp</code> and <code>dumpdata</code>. I am trying to INSERT or UPDATE data from the <code>dumpdata_temp</code> Mysql TABLE to <code>dumpdata</code>.</p>
  <p><code>dumpdata_temp</code> is the temporary table which has the Raw data</p>
  <pre><code>CREATE TABLE  `dumpdata_temp` (
  `TEST_ID` int(11) NOT NULL AUTO_INCREMENT,
  `QTY` varchar(255) NOT NULL,
  `SKU` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`TEST_ID`)
  ) 
  
  CREATE TABLE  `dumpdata` (
  `TEST_ID` int(11) NOT NULL AUTO_INCREMENT,
  `QTY` varchar(255) NOT NULL,
  `SKU` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`TEST_ID`)
  ) 
  </code></pre>
  <p>I tried with</p>
  <p>INSERT INTO <code>dumpdata</code> SELECT * FROM <code>dumpdata_temp</code>;</p>
  <pre><code>There are 2 conditions that I am trying to achieved with an IF ELSE
  </code></pre>
  <p>1: IF the column SKU in the <code>dumpdata_temp</code> file <code>MATCHES</code> with the column SKU in the <code>dumpdata</code> table THEN UPDATE column <code>QTY=1</code> in the database.</p>
  <p>2: IF the column SKU in the <code>dumpdata_temp</code> file <code>DOES NOT MATCH</code> with the column SKU in the <code>dumpdata</code> table THEN INSERT that whole row (record) as it is.</p>