Copying a Table in MySQL and including the Primary Key
- by Alan Storm
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??