How to copy a sql table into another sql table

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 :

$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`”);

Leave a Reply

Related Posts: You may like

comma separated values in mysql query

SQL statement to retrieve names beginning with A

Php pdo prepared statements select insert update queries

php pdo queries statements select insert update delete


Crypto Currency

PHPKIDA provides free online the best real-time crypto market price, news, predictions, index with graphs & historical data for 2000+ coins including bitcoin, ethereum, & altcoins from major cryptocurrency exchanges.

Visite Tool

Icon Generator

PHPKIDA provides free online icon generator. Our icon generator help you to edit, modify, resize and customize icon for your website and applications. Convert to a shap you like add icon border, you can change icon border color, border size, background color, icon shadow, icons color, icon size in your own way and save it as a png image.

Visite Tool

Youtube Video Downloader

PHPKIDA provides Free online YouTube video downloader to download YouTube videos quickly in MP4, 3GP, and more. Search your video and free fast download youtube videos.

Visite Tool

Sign up for weekly update

Milkshake is almost ready. If you're interested in testing it out, then sign up below to get exclusive access.