how to copy data from one table to another table in mysql

INSERT  INTO  TABLE2  SELECT  *  FROM  TABLE1





INSERT INTO TABLE2 (COL1, COL2, COL3) SELECT COL1, COL4, COL7 FROM TABLE1

copy table one database to another database 

CREATE TABLE database2.`tablename2` SELECT * FROM database1.`tablename1`

NOTE:
it must you have database1 , database2 and tablename1
Create similar table in mysql 

CREATE TABLE new_table_name LIKE tablename2;



Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s