Here is something convoluted and sick ...

run 'mysqldump --no-data <database> <table-name>' and redirect to a text file.
change the table name and column names in the text file as desired (using perl)
run mysql client redirect input from the text file

Something with more dignity (and no perl)

create table <tbl-new> like <tbl-old>;
alter table <tbl-new> add  column column-2 <definition of column-1> after 
column-1;
alter table <tbl-new> drop column column-1;

Give a try (the latter one, of course)

----- Original Message -----
From: "Tim Johnson" <[EMAIL PROTECTED]>
To: "MySQL General Mailing List" <mysql@lists.mysql.com>
Sent: Tuesday, February 6, 2007 7:15:12 AM (GMT-0500) US/Eastern
Subject: Cloning a table with different column names

Hello:

I have a need to create two tables from imported data.
The only difference between the tables is the column names.

The data will be the same.

Can anyone propose a mysql method to create a new table
from an existing table with new column names?

thanks
tim
-- 
Tim Johnson <[EMAIL PROTECTED]>

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]



-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to