MySQL Forums
Forum List  »  Newbie

Do not copy. Create...
Posted by: Владислав Сокол
Date: January 05, 2022 04:18AM

Do not copy. Do not create new table separately at all. Use CREATE .. SELECT and define only columns which are absent in source table:

CREATE TABLE new_table (id INT AUTO_INCREMENT PRIMARY KEY)
SELECT * FROM old_table;

You can see this method on this demo fiddle: https://dbfiddle.uk/?rdbms=mysql_8.0&fiddle=e87757fd195a22d261a08736e90df949

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.