MySQL Forums
Forum List  »  Newbie

Re: Add new colums to one existing table with copying from another existing table
Posted by: Barry Galbraith
Date: October 15, 2016 11:58PM

Maybe it's just me, but it looks like table 2 will be a direct copy of table 1. Why not just rename table 1 to table 2 and rename the fields?

If it has to be a new table, then what about something like

CREATE table2 (temc int, name_x varchar(20), name_y varchar(20)) SELECT temc, name_a, name_b from table1;

DROP table1;

Good luck,
Barry.

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.