Total members 11890 |It is currently Fri Apr 19, 2024 8:56 pm Login / Join Codemiles

Java

C/C++

PHP

C#

HTML

CSS

ASP

Javascript

JQuery

AJAX

XSD

Python

Matlab

R Scripts

Weka






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' 




_________________
M. S. Rakha, Ph.D.
Queen's University
Canada


Author:
Mastermind
User avatar Posts: 2715
Have thanks: 74 time
Post new topic Reply to topic  [ 1 post ] 

  Related Posts  to : SQL COPY TABLE Command
 SQL RENAME TABLE Command     -  
 Copy Constructor     -  
 copy folder     -  
 copy file     -  
 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 LOCATE command     -  



cron






Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
All copyrights reserved to codemiles.com 2007-2011
mileX v1.0 designed by codemiles team
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com