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`”); ?>
My name is Mukesh Jakhar and I am a Web Application Developer and Software Developer, currently living in Jaipur, India. I have a Master of Computer Application in Computer Science from JNU Jaipur University. I loves to write on technology and programming topics. Apart from this, I love to travel and enjoy the beauty of nature.