Mega Code Archive

 
Categories / MySQL / Table Index
 

Copying a Table

/*create a copy of a table so that you can alter it or experiment with it without endangering the original data */ CREATE TABLE new_table_name SELECT * FROM old_table_name; /* Differences: their names,                 if the old table had an index (or key), it does not transfer to the new table.  only two columns chosen */