List:General Discussion« Previous MessageNext Message »
From:Dan Nelson Date:November 13 2000 8:55pm
Subject:Re: How to clone an existing table structure?
View as plain text  
In the last episode (Nov 13), indrek siitan said:
> Hi,
> 
> > me@foo> mysqldump --no-data mydb peopletable \
> >         | sed -e "/CREATE TABLE /s/peopletable/newpeople/" \
> >         | mysql mydb
> 
> CREATE TABLE newpeople SELECT * FROM peopletable;

.. and if you only want to copy table structure, and no data:

  CREATE TABLE newpeople SELECT * FROM peopletable WHERE 1=0

You'll have to recreate indexes manually.

-- 
	Dan Nelson
	dnelson@stripped
Thread
mysqldump does not dump table optionsSchwenke13 Nov
  • How to clone an existing table structure?Thomas Spahni13 Nov
    • RE: How to clone an existing table structure?indrek siitan13 Nov
      • Re: How to clone an existing table structure?Dan Nelson13 Nov