dcsimg
 

Submitted by: M S Sridhar(sridhar.ms@gmail.com)

Friday Mar 16th 2018 by M S Sridhar

Language: SQL, Expertise: Intermediate - Learn how to easily create a new table that includes the indexes of the source table.

MySQL provides a command named LIKE that can be used in CREATE TABLE command. This is most useful when you want to create a new table along with the indexes of the source table.

CREATE TABLE new_table LIKE existing_table

The LIKE command will replicate the existing_table structure to the new_table along with the indexes as well.

Note: Foreign keys will not be copied.

Home
Mobile Site | Full Site