Saturday, June 23, 2012

MySQL Workbench: Copy Table Structure and Data

Right mouse click the table you want to copy and choose, "Send to SQL Editor -> Create Statement"
Select all and execute the statement (lightening bolt icon)
In SQL statement, change table name
Then execute the statement:

INSERT INTO `table2` SELECT * FROM `table1`

12 comments:

  1. Ah yeah, I was wondering if there was a quick way of doing that...! Thanx

    ReplyDelete
  2. Excellent, thanks for posting.

    ReplyDelete
  3. create table new_table_name(like old_table_name);
    anther easy to copy tables

    ReplyDelete
  4. to copy the data from table
    insert into new_table_name(select * from old_table_name);

    ReplyDelete
  5. This comment has been removed by the author.

    ReplyDelete
  6. You know what I love about your content ? it is SUCCINCT .

    ReplyDelete
  7. Thanks for this.

    ReplyDelete