How we can copy one table data into another table whose name
same as table but in differ database

Answer Posted / saket bharti

create table database2.tablename as (select * from
database1.tablename where 1=2);

This will create a new table in database2 with the same
structure as the table in database1 ,but will not contain
any values or constraints of database1 table.

create table database2.tablename as (select * from
database1.tablename );

This will create a new table in database2 with all the
structure and values from the table from database1.

Is This Answer Correct ?    1 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How to show all records starting with the letters 'sonia' and the phone number '9876543210'

694


How to control the max size of a heap table?

712


How do I create a schema in mysql?

652


Why we use mysqli instead of mysql?

742


What do ddl, dml, and dcl stand for?

649


What are the different column comparison operators in mysql?

659


What is query design?

639


using primary can we relate two table, with out foreign key?

2464


How to insert html code into mysql database using php?

747


How we can create index in mysql?

692


What is insert query in mysql?

649


Can we save images in mysql database?

653


How do I disable mysql?

678


What does mysql_query return?

703


What is pdo mysql?

679