Re: CREATE TABLE LIKE, error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: "Adam i Agnieszka Gasiorowski FNORD" <agquarx@xxxxxxxxxxxxxxxxxx>

> 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...

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux