On Fri, 2 Jan 2004, Roger Baklund wrote: > * Gohaku > > I was just curious if there's a shorthand way of replicating a Table > > Schema. > > I use the following to create a new Table with the same schema. > > >create table new_table ( select * from table); > > >delete from new_table; > > You can avoid the DELETE by specifying a non-true WHERE clause: > > CREATE TABLE new_table SELECT * FROM table WHERE 1=0 > > <URL: http://www.mysql.com/doc/en/CREATE_TABLE.html > >
Do, however, note that this does not copy the index-structure, nor attributes like auto_increment. You can use CREATE TABLE table_copy LIKE table_original Or if you want the whole create statement just to store can use mysqldump from outside the client or use SHOW CREATE TALE table_original -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]