MySQL Forums
Forum List  »  Newbie

Re: create or rename table or database
Posted by: Nick Roper
Date: August 13, 2004 03:27PM

You can create a new table based on an existing table wiyj:

CREATE TABLE newtable
SELECT * FROM oldtable;

However, this will also include the data. To create the new table without the data, use a WHERE clause that returns no rows, e.g:

CREATE TABLE newtable
SELECT * FROM oldtable
WHERE 0;

You can use mysqldump and mysqlimport to replicate a database

Nck


--
Nick Roper

Options: ReplyQuote


Subject
Written By
Posted
Re: create or rename table or database
August 13, 2004 03:27PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.