List:General Discussion« Previous MessageNext Message »
From:James Treworgy Date:January 20 2000 6:45pm
Subject:Copy table or table structure
View as plain text  
Forgive me if this is an obvious FAQ. I haven't been able to find an answer 
in the documentation

Standard SQL syntax allows you to SELECT... INTO ... to copy a table or 
create a new table from the results of a query.  The MySQL docs explain 
that this isn't supported and give some workarounds.  However, I was not 
able to successfully duplicate this functionality, which is, create a 
completely new table with the identical structure as an existing table or 
query.  If this can be done I would appreciate someone spelling it out for me.

In the same vein, how would you output from MySQL the *text* of a CREATE 
statement which will duplicate an existing table structure? That is, 
suppose I want to copy a table from one server to another (happens often in 
what I'm doing, since I do testing on a local server and move tables to 
production server when done).   I've been doing this lamely using Microsoft 
Access and MyODBC to export the tables to the other server, but it always 
loses the indices.

I used to use an ISP that had a simple CGI interface to MySQL that allowed 
you to do this for tables on their server, and have not been able to 
replicate this functionality on my own servers (without writing a bunch of 
code which I'm trying to avoid ;-)

Copy table or table structureJames Treworgy20 Jan
  • Re: Copy table or table structuresinisa20 Jan
Re: Copy table or table structurePeter Hurd20 Jan
  • Re: Copy table or table structureM. Mani23 Jan