MySQL Forums
Forum List  »  Newbie

Re: Create new table and insert other table data
Posted by: Ramalingam Chelliah
Date: August 26, 2004 04:50AM

Hi ,
Do like this ...

( But I am not sure whether Constraints are copied ..)

mysql>CREATE TABLE tbl_200410
AS
SELECT Field1,Field2,Field4
FROM
master;
( For selecting Field1,Field2,Field4 from master)

You may also give conditions in SELECT statement

mysql>CREATE TABLE tbl_200410
AS
SELECT Field1,Field2,Field4
FROM
master
WHERE Field1 IS NOT NULL;

Hope this helps ,

Regards,
Ram.

P.S:

However , Check the description of both tables
mysql> DESC master;
mysql>DESC tbl_200410;

and check constraint info ...

Otherwise ALTER tbl_200410 to add the required constraints...




We Learn the Most When we have to Invent

Options: ReplyQuote




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.