Problem statement: How do you insert data of one table to other table for back up purpose?
Syntax:
INSERT new_table SELECT * FROM old_table;
e.g.
id | name | salary
01 ram 2000
02 rani 3000 ==> old_emp [old_table]
03 lata 1500
04 mary 1700
INSERT new_emp SELECT * FROM old_emp;
id | name | salary
01 ram 2000
02 rani 3000 ==> new_emp [new_table]
03 lata 1500
04 mary 1700
Syntax:
INSERT new_table SELECT * FROM old_table;
e.g.
id | name | salary
01 ram 2000
02 rani 3000 ==> old_emp [old_table]
03 lata 1500
04 mary 1700
INSERT new_emp SELECT * FROM old_emp;
id | name | salary
01 ram 2000
02 rani 3000 ==> new_emp [new_table]
03 lata 1500
04 mary 1700
No comments:
Post a Comment