MySQL Forums
Forum List  »  Newbie

Copy entire table
Posted by: Frank Thomson
Date: January 04, 2022 07:53PM

I would like to copy the entire contents of one table to a second table that has a new id field

new_table will be id plus all the columns of the old table.

if new_table has no fields then this copies all the data OK
INSERT INTO new_table SELECT * FROM original_table;

BUT
if new_table already has the id field then I get an error
mysql error no= 1136: Column count doesn't match value count at row 1

Help appreciated.
Thanks

Options: ReplyQuote




Sorry, only registered users may post in this forum.

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.