MySQL Forums
Forum List  »  Newbie

adding a column with data
Posted by: Trym Bagger
Date: July 21, 2006 04:41AM

How do I add a new column with data to an existing table, ensuring correct record matching?

Situation:

I have a table named 'maintable' with 5 columns (ID, firstname, lastname, phone and fax) and 1000 records. ID is the primary key. Now I need to add (import) a new column (cellphone) already containing data from a one-column table called 'extratable'.

The order of the records in both tables are identical, in other words the cellphone number in record 37 of the table 'extratable' corresponds to record 37 the table 'maintable'.

Or would it be better to create a new table, merging the two existing tables. If so, how is that done?

Thanks in advance.

TB

Options: ReplyQuote


Subject
Written By
Posted
adding a column with data
July 21, 2006 04:41AM


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.