0

I have around 40 million rows in a MySQL table. I want to copy this table into another table of same database. What is the most efficient way to do this? How much time will it take (approx.)?

0

3 Answers 3

2

Try this

CREATE TABLE new_table LIKE old_table;
INSERT INTO new_table SELECT * FROM old_table;
Sign up to request clarification or add additional context in comments.

Comments

0
INSERT INTO table2(column1,column2,....) SELECT column1,column2,... FROM table1;

Comments

0
create table new_table as select * from Old_table;

when you copy data in this way all constraint are also copy in new table if you create table separate query and insert data through separate query constraint are not copied in new table

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.