title: Migrate data between two databases with different layouts
body: <p>I'm developing a new site, I have to migrate it's old data to the new database, which has a new layout structure.<br><br> I'm finding hard to migrate, the multiple addresses that one person might have.<br><BR>Just a detail, when I'm inserting these clients from the old db, I'm letting auto incremental sets it's ID, so new clients ID will be different from the old database table, should I keep them the same?<BR><BR>Consider the follow tables structures:<br><BR>
  <strong>CLIENT TABLE</strong>:</p>
  
  <pre><code>#|id_client|#|name|#
  #|    1    |#|John|#
  #|    2    |#|Bob |#
  #|    3    |#|Karl|#
  </code></pre>
  
  <p>This table is easy to migrate, I only have to do:</p>
  
  <pre><code>INSERT INTO NEW_DB.CLIENT SELECT * FROM (SELECT id_cliente,name FROM OLD_DB.CLIENT)
  </code></pre>
  
  <p>But what if I have an addresses table, that an user might have 0..n addresses?<br> How will I insert it with the FK reference to Client.id_client, remembering that the new client ID is different from the old one?</p>
  
  <pre><code>#|id_address|#|address|#|Client_id_client
  #|    1     |#|Addr123|#|       1
  #|    2     |#|Addr321|#|       1
  #|    3     |#|Addr124|#|       2
  </code></pre>