title: Yii2 Copy table from one db to another db
body: <p>In yii2 I have to copy the whole table from one DB to another DB</p>
  <p>and for that I used bellow code but its throing error:</p>
  <pre><code>$dbName = &quot;db1&quot;;
  $table = &quot;demotable&quot;;
  $liveDbName = &quot;db2&quot;;
  $command3 = $connection-&gt;createCommand('CREATE TABLE `'.$dbName.'.'.$table.'` SELECT * FROM `'.$liveDbName.'.'.$table.'`');
  $command3-&gt;execute();
  </code></pre>
  <p>but getting error like:</p>
  <pre><code>Database Exception – yii\db\Exception
  SQLSTATE[42S02]: Base table or view not found: 1146 Table 'db1.db2.demotable' doesnt exist
  The SQL being executed was: CREATE TABLE `db1.demotable` SELECT * FROM `db2.demotable`
  
  Error Info: Array
  (
      [0] =&gt; 42S02
      [1] =&gt; 1146
      [2] =&gt; Table 'db1.db2.demotable' doesnt exist
  )
  </code></pre>