Monday, 20 August 2012

copy table values of one database to another database

consider you are having two databases

Eg:  db-sample   and db-sample1

These two databases have the same  table  Student


The database of db-sample with table Student has 1000   records  and the table of Student in db-sample1
needs all those records

we can use the following query

First  set db-sample database as default Schema

Query

insert into Student SELECT * FROM `db-sample`.Student

where

Student - It is the table name of the dabase db-sample1

Student It is the table name of the dabase  db-sample