Mega Code Archive
Categories
/
MySQL
/
Data Type
Preserve column attributes such as AUTO_INCREMENT and columns default value during table copying
CREATE TABLE dst_tbl (PRIMARY KEY (id)) SELECT * FROM src_tbl; ALTER TABLE dst_tbl MODIFY id INT UNSIGNED NOT NULL AUTO_INCREMENT;