MySQL One to Many to Many To Many Conversion
<p>I have a table having one to many relationship.</p>

<pre><code>tblAuthor
id
name

tblPublisher
id
name

tblBooks
title
author_id
publisher_id
</code></pre>

<p>I am converting it to hold multiple Authors and Multiple Publisher. So my new table schema is now.</p>

<pre><code>tblAuthor
id
name

tblPublisher
id
name

tblBooks
id
title

tblBooksAuthor
book_id
author_id

tblBooksPublisher
book_id
publihser_id
</code></pre>

<p>How can i migrate my data to new tables. And what is the best solution.<code>tblBooks</code> contain around 1M rows. Is insert into only way ?</p>

<pre><code>INSERT INTO tblBooksPublisher (book_id, publihser_id)
SELECT id, publihser_id
FROM tblBooks;
</code></pre>