Home  • Database • MySQL

Copy an existing MySQL table data and structure

MySQL Copy both an existing MySQL table data and structure to a new table
CREATE TABLE student1 SELECT * FROM student;
CREATE TABLE student2 LIKE student;
CREATE TABLE IF NOT EXISTS student3 SELECT * FROM student;
Copy only an existing MySQL table data to another existing table
INSERT into student5 SELECT * FROM student;
INSERT into student6(name,phone) SELECT name,phone FROM student;
INSERT into student7(name,phone) SELECT name,phone FROM student where class='7';

Comments 1


CREATE TABLE student2 LIKE student;  - This command copy only table structure not table data

Share

Copyright © 2024. Powered by Intellect Software Ltd