[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Edlug Archive Mar 2004 ]

Re: [edlug] MySQL copy table structure



El mar, 02-03-2004 a las 14:56, Catriona & Anand escribió:
> Hello all,
> 
> I am new to MySQL and am picking up the syntax as I go along. Right now, I 
> need to create a table with the same structure as an existing one. The manual 
> does not seem to offer a way to do this. In dBase there was a "COPY 
> STRUCTURE" command, but I can't find an equivalent.

create table newtable like oldtable :-)


http://www.mysql.com/doc/en/CREATE_TABLE.html

"""In MySQL 4.1, you can also use LIKE to create a table based on the
definition of another table, including any column attributes and indexes
the original table has:

CREATE TABLE new_tbl LIKE orig_tbl;

CREATE TABLE ... LIKE does not copy any DATA DIRECTORY or INDEX
DIRECTORY table options that were specified for the original table."""



-- 
Backup not found: (A)bort, (R)etry, (S)uicide?

-
----------------------------------------------------------------------
You can find the EdLUG mailing list FAQ list at:
http://www.edlug.org.uk/list_faq.html



This archive is kept by wibble@morpheux.org.DONTSPAMME
homepage