Home > Mysql > How to copy a table structure and data

How to copy a table structure and data

To copy table structure run this query

CREATE TABLE database_name.`new_table_name` LIKE database_name.`old_table_name` ;

To copy table data run this query

INSERT INTO database_name.`new_table_name` SELECT * FROM database_name.`old_table_name` ;

Advertisement
  1. November 15, 2011 at 5:24 pm | #1

    Hello! interesting site! I’m really like it! Very, very good!

  2. November 21, 2011 at 10:39 pm | #2

    Thanks a ton for taking a few minutes to line this all out for people. This write-up ended up being quite helpful if you ask me.

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.