Copying a Table in MySQL and including the Primary Key
Posted
by Alan Storm
on Stack Overflow
See other posts from Stack Overflow
or by Alan Storm
Published on 2010-04-30T22:20:19Z
Indexed on
2010/04/30
22:27 UTC
Read the original article
Hit count: 208
I have an ancient code snippet I use for copying tables in MySQL.
CREATE TABLE new_table (select * from old_table);
This works great, with one exception. It doesn't copy the primary key or other table indexes.
Is there any way to copy a table in MySQL AND include the indexes/primary key??
© Stack Overflow or respective owner