I want to copy one table to another one.
For example I have table Data(ID, time, serial_number...)
and I have Temp_data(ID, time, serial_number...)
How to copy all items without primary key (ID
).
I am using MYSQL,
I have tried INSERT INTO Data SELECT * FROM Temp_data;
Problem is in primary key. both of the tables already have values and I need everything to be copied except ID.
Instead of SELECT *
, spell out the columns that you want:
INSERT INTO Data (time, serial_number...)
SELECT (time, serial_number...) FROM Temp_data;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With