Saturday, November 12, 2011

Mysql Copy table structure only

Sometimes we need to create a empty table from already existing table , here is the command to create new table from already existing table.

CREATE TABLE 'newtable' LIKE 'oldtable'

Here you can create a 'newtable' with the same structure from 'oldtable'. No one data will copied.

Note: Autoincrement also reset to 1.

No comments:

Post a Comment