Snipt.net is closing on December 31st, 2016

For more information, please visit this blog post.

snipt

Ctrl+h for KB shortcuts

MySQL

Copy table from 1 database to another.

DROP TABLE IF EXISTS `db1`.`tbl`;
CREATE TABLE `db2`.`tbl` SELECT * FROM `db1`.`tbl`;
https://snipt.net/embed/fc281313adf8a9c1ab00acccf85c93e5/
https://snipt.net/raw/fc281313adf8a9c1ab00acccf85c93e5/
fc281313adf8a9c1ab00acccf85c93e5
mysql
MySQL
2
2016-12-05T21:27:07
True
False
False
/api/public/snipt/36543/
copy-table-from-1-database-to-another
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="k">DROP</span> <span class="k">TABLE</span> <span class="k">IF</span> <span class="k">EXISTS</span> <span class="ss">`db1`</span><span class="p">.</span><span class="ss">`tbl`</span><span class="p">;</span> </span><span id="L-2"><a name="L-2"></a><span class="k">CREATE</span> <span class="k">TABLE</span> <span class="ss">`db2`</span><span class="p">.</span><span class="ss">`tbl`</span> <span class="k">SELECT</span> <span class="o">*</span> <span class="k">FROM</span> <span class="ss">`db1`</span><span class="p">.</span><span class="ss">`tbl`</span><span class="p">;</span> </span></pre></div> </td></tr></table>
copy, mysql, sync, table
Copyrighted, illegal, or inappropriate content? Email [email protected].