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

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
mbaroz
Forum Commoner
Posts: 29
Joined: Sun Feb 05, 2006 10:10 am

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

Post 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
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

CREATE TABLE `newTable` LIKE `oldTable`

http://dev.mysql.com/doc/refman/4.1/en/ ... table.html
User avatar
raghavan20
DevNet Resident
Posts: 1451
Joined: Sat Jun 11, 2005 6:57 am
Location: London, UK
Contact:

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