Switch to full style
Include SQL commands
Post a reply

SQL COPY TABLE Command

Sun Jul 15, 2012 10:17 pm

To selectively copy data from one table to another. It may be used as backup.

Code:

CREATE TABLE Department2 SELECT 
FROM Department


You can also add where clause to the selection part :

Code:

CREATE TABLE Department2 SELECT 
FROM Department where DeptId=3



If you want to copy only the table structure use following :
Code:

create table d1 like Department



You can create table only if it is not exist
Code:

CREATE TABLE 
IF NOT EXISTS Department3 SELECT FROM Department WHERE Dept='2' 




Post a reply
  Related Posts  to : SQL COPY TABLE Command
 SQL RENAME TABLE Command     -  
 copy file     -  
 Copy Constructor     -  
 copy folder     -  
 I'd like to copy this Skymiles_red site     -  
 moving file with copy() function in php     -  
 copy files from applet server to client     -  
 Laserwords Private Limited Chennai : COPY EDITOR     -  
 BETWEEN SQL COMMAND     -  
 SQL GROUP BY Command     -