Copying an existing table to a new table in MySQL

Discussion in 'MySQL' started by pradeep, Dec 23, 2006.

  1. pradeep

    pradeep Team Leader

    Joined:
    Apr 4, 2005
    Messages:
    1,645
    Likes Received:
    87
    Trophy Points:
    0
    Occupation:
    Programmer
    Location:
    Kolkata, India
    Home Page:
    http://blog.pradeep.net.in
    Sometimes we require to copy an existing MySQL table to another table, usually we get the SQL dump and execute it to create the new table, but we have a shortcut to do that.

    For instance if we need to make a copy of go4expert_users to a table named go4expert_users_new we need to execute the following command.

    Code:
    INSERT go4expert_users_new SELECT * FROM go4expert_users; 
    The query copies the data from old to new.Try it! ;)
     
  2. kingswhale

    kingswhale New Member

    Joined:
    Sep 28, 2011
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    Occupation:
    Network Administrator
    Location:
    Osogbo, Osun State of Nigeria
    i love this post, but am still a leaner. so one day i will come out shining
     
  3. mukeshsoftona

    mukeshsoftona Banned

    Joined:
    Oct 28, 2011
    Messages:
    47
    Likes Received:
    0
    Trophy Points:
    0
    Hey dear!

    I love this topic and want to know more about MQL.
    There is something different between mysql and sql
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice