1. Get the structure of test_table from the source database.
> use database1;
> show create table test_table;
2. Copy the Complete CREATE TABLE `test_table` query
3. Remove the "AUTO_INCREMENT=xxxxxxx" Portion from the query.
4. Insert this query to the new database;
> use database2;
> Paste the CREATE TABLE query and press enter.
5. Now the tricky part, the below command will select the last 5 records from the test_table of database1 and insert into the test_table of database2.
> insert into database1.test_table select * from database2.test_table order by cur_date desc limit 5;
Thats all Folks,
Cheers.
> use database1;
> show create table test_table;
2. Copy the Complete CREATE TABLE `test_table` query
3. Remove the "AUTO_INCREMENT=xxxxxxx" Portion from the query.
4. Insert this query to the new database;
> use database2;
> Paste the CREATE TABLE query and press enter.
5. Now the tricky part, the below command will select the last 5 records from the test_table of database1 and insert into the test_table of database2.
> insert into database1.test_table select * from database2.test_table order by cur_date desc limit 5;
Thats all Folks,
Cheers.
Comments