database - Revert backup table data to original table SQL -


i have created backup country table.

create table country_bkp select * country; 

what sql should use restore country table it's original state? can do

insert country select * country_bkp; 

but have duplicate entries , fail primary key same .

is there sql command merge data back?

last alternative be

drop table country; create table country select * country_bkp; 

but want avoid grants/permissions lost this.

other cleaner way be

delete country ; insert country select * country_bkp; 

but looking more of merge approach without having clear data original table.

instead of dropping table, which, noted, lose permission defitions, truncate remove data, , insert-select old data:

truncate table country; insert country select * county_bkp; 

Comments

Popular posts from this blog

python - TypeError: start must be a integer -

c# - DevExpress RepositoryItemComboBox BackColor property ignored -

django - Creating multiple model instances in DRF3 -