title: Deleting rows from one table if row exists in another table in MySQL
body: <p>I am migrating data from an old training tracking system and I am using MySQL to format the data for the new training tracking system. </p>
  
  <p>I have one table with 5.5 million rows which is the master set of data from the old system. I also have a table with around 49,000 rows that had been migrated previously. </p>
  
  <p>What I am trying to do is compare the two tables and remove from the master data file the records that have been previously migrated (I don't want to create duplicate records in the new system.)</p>
  
  <p>For the comparison I need to compare 3 fields (employee_id, course_code, and completion_date.) I am using the following SQL statement, but it just sits and spins. I don't know if it is working and just taking a long time or if it is really not working.</p>
  
  <pre><code>DELETE master_data.*
  FROM master_data
  INNER JOIN alreadyMigrated
  ON master_data.employee_id = alreadyMigrated.employee_id 
  AND master_data.course_code = alreadyMigrated.course_code
  AND master_data.completion_date = alreadyMigrated.completion_date;
  </code></pre>
  
  <p>I also don't know if indexes would help. Any help would be appreciated. Thanks.</p>