Pages Navigation Menu

Coding is much easier than you think

SQL Script to create a backup of a table

 
The below are the MYSQL script, which takes a backup/copy of the entire table into a temp table. This makes sure that you have a full backup of the data and table format, These query will be quiet useful in case something goes wrong.
You can use either of these queries to create a backup.

 

1)
CREATE TABLE employees_backup AS ( SELECT * from employees);

2)
CREATE TABLE SCHEMA.employees_backup LIKE SCHEMA.employees;
INSERT SCHEMA.employees_backup SELECT * FROM SCHEMA.employees;

 

About Mohaideen Jamil