Page 1 of 1

Creating a new table from other table in other database in m

Posted: Sun Feb 19, 2006 8:30 am
by mbaroz
Hi
I would like to create a php code that creates a mysql table from another , with preserving indexes and keys.
how should i do this ?
the : "create table select * from oldtable" does not work.
thanks
moshe

Posted: Sun Feb 19, 2006 9:01 am
by feyd
CREATE TABLE `newTable` LIKE `oldTable`

http://dev.mysql.com/doc/refman/4.1/en/ ... table.html

Posted: Sun Feb 19, 2006 9:30 am
by raghavan20
feyd wrote:CREATE TABLE `newTable` LIKE `oldTable`

http://dev.mysql.com/doc/refman/4.1/en/ ... table.html
mbaroz. remember to put the database names before table names if they are in different databases.