How to copy a sql table into another sql table
If you want to copy a SQL table into another table in the same SQL server database, it is possible by using the sql select statement.
The syntax of copying table from one to another is given below.
Select * into from
The Example of copying table from one to another is given below, here we copy employee table into employee1. Using this command you can copy a sql table into another sql table in same database. You just have need copy that code, past and change the name of tables.
Simple mysql copy table Query :
select * into employee1 from employee;
Mysql copy table query with PHP Script :
<?php $hostname = 'localhost'; $username = 'root'; $pass = ''; $conn = mysql_connect($hostname, $username, $pass) or die(mysql_error()); mysql_select_db('temp_db') or die(mysql_error()); mysql_query(“SELECT * into `employee` from `employee1`”); ?>