mysql - How to move all data from one SQL table to another -


this question has answer here:

i want move data 1 sql table another, both tables have identical structures.

sample data:

table | id | name | address|  table b | id | name | address| 

requirement :
move data table b table a, don't want use select on table b , insert on table data. preferably, alter table structures, achieve this.

initial thoughts :
deleted table a, , renamed table b table a. worked. problem cannot append data in table a. want retain data in table a, , append data in table b table a. so, solution didn't work.

any pointers on how proceed this, appreciated.

edit :
apologies all, stupid question. best way use insert ... select... apologies, again!

you should able rename both tables in single mysql rename table statement

rename table tablea tableb, tableb tablea 

should mysql throw error or not work correctly above, instead use dummy name , 3 statements.

rename table tablea badtable; rename table tableb tablea; rename table badtable tableb; 

Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -