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

What does do in mysql?

468


What is required to create mysql database?

510


What is max connection in mysql?

487


What is bigint in mysql?

510


Can we store images in mysql database?

470






What is mysql and why it is used?

550


How do I setup a mysql database?

462


What port is mysql running on?

467


What is the latest version of mysql?

489


How do you rename a table in mysql?

500


How to store values to array from mysql database in php?

433


How do I run a query in mysql?

475


What could be the reason that the mysql statement 'select avg (salary) from emp' generates an inaccurate output?

491


What you can use regular expression for in mysql?

477


How to delete a trigger in mysql?

480