1. 快速創建相同結構的表,包括索引:
mysql>SHOWCREATETABLEa;
CREATETABLE`a`(
`name`varchar(50)defaultNULL,
KEY`name`(`name`)
)ENGINE=MyISAMDEFAULTCHARSET=latin1;
mysql>CREATETABLEbLIKEa;
mysql>SHOWCREATETABLEb;
CREATETABLE`b`(
`name`varchar(50)defaultNULL,
KEY`name`(`name`)
)ENGINE=MyISAMDEFAULTCHARSET=latin1;
2. 快速創建一個相同結構的表,但是不創建索引:
mysql>SHOWCREATETABLEa;
CREATETABLE`a`(
`name`varchar(50)defaultNULL,
KEY`name`(`name`)
)ENGINE=MyISAMDEFAULTCHARSET=latin1;
mysql>CREATETABLEcSELECT*FROMaLIMIT0;
mysql>SHOWCREATETABLEc;
CREATETABLE`c`(
`name`varchar(50)defaultNULL
)ENGINE=MyISAMDEFAULTCHARSET=latin1;