Re: CREATE TABLE LIKE, error

From: Date: Mon, 15 Dec 2003 16:45:29 +0000
Subject: Re: CREATE TABLE LIKE, error
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-32055@lists.php.net to get a copy of this message
From: "Adam i Agnieszka Gasiorowski FNORD" <agquarx@venus.ci.uw.edu.pl> > I cannot use this query > > CREATE TABLE table LIKE other_table; > > , which is supposed to create an > empty "clone" of the other_table named > table. > Was it added in some later MySQL version? > It's in the manual on mysql.com, bo no version info > available. Sure there is, you just had to keep reading. Quote: 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. Since this is a PHP list, an alternative, two-step method is to issue a SHOW CREATE TABLE Table_Name query, retrieve the results, and use them to create your second table (replacing the table name, of course). ---John Holmes...

« previous php.db (#32055) next »