Paste this into a new question or an answer at dba.stackexchange.com:
<!-- --> > CREATE TABLE old_table (column1 INT, column2 VARCHAR(255)); > INSERT INTO old_table VALUES (11, 'value 11'), (123, 'value 123'), (12, 'value 1234'), (13, 'value 1313'); > SELECT * FROM old_table; > SHOW CREATE TABLE old_table; > > <pre> > ✓ > > ✓ > > column1 | column2 > ------: | :--------- > 11 | value 11 > 123 | value 123 > 12 | value 1234 > 13 | value 1313 > > Table | Create Table > :-------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------- > old_table | CREATE TABLE `old_table` (&lt;br&gt; `column1` int DEFAULT NULL,&lt;br&gt; `column2` varchar(255) DEFAULT NULL&lt;br&gt;) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci > </pre> <!-- --> > CREATE TABLE new_table (id INT AUTO_INCREMENT PRIMARY KEY) SELECT * FROM old_table; > SELECT * FROM old_table; > SELECT * FROM new_table; > SHOW CREATE TABLE new_table; > select max(id) from new_table; > insert into new_table set column1='10', column2='michaelangelo'; > select max(id) from new_table; > SELECT * FROM new_table; > > <pre> > ✓ > > column1 | column2 > ------: | :--------- > 11 | value 11 > 123 | value 123 > 12 | value 1234 > 13 | value 1313 > > id | column1 | column2 > -: | ------: | :--------- > 1 | 11 | value 11 > 2 | 123 | value 123 > 3 | 12 | value 1234 > 4 | 13 | value 1313 > > Table | Create Table > :-------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- > new_table | CREATE TABLE `new_table` (&lt;br&gt; `id` int NOT NULL AUTO_INCREMENT,&lt;br&gt; `column1` int DEFAULT NULL,&lt;br&gt; `column2` varchar(255) DEFAULT NULL,&lt;br&gt; PRIMARY KEY (`id`)&lt;br&gt;) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci > > | max(id) | > | ------: | > | 4 | > > ✓ > > | max(id) | > | ------: | > | 8 | > > id | column1 | column2 > -: | ------: | :------------ > 1 | 11 | value 11 > 2 | 123 | value 123 > 3 | 12 | value 1234 > 4 | 13 | value 1313 > 8 | 10 | michaelangelo > </pre> *db<>fiddle [here](https://dbfiddle.uk/?rdbms=mysql_8.0&fiddle=f014af2b303c8e45d1dbb8e3599f747a)*
back to fiddle