I executing this statement:
CREATE TABLE test_mod SELECT * FROM `test`
This copied a table into the newly created table. Then I executed this:
INSERT INTO test_mod(`test_name`) SELECT `test_name` FROM test
That statement should have inserted more data to the newly created table. It did so, but the primary key are all 0?!?!
The I executed this statement:
ALTER TABLE test_mod MODIFY test_id INT UNSIGNED NOT NULL AUTO_INCREMENT
And phpmyadmin told me that the column test_id has already an auto_increment attribute.. so how can I populate more data while having an auto increment functionality?
Try
This will copy the table definition from “test” and insert all data from it into “test_mod”.