How do you insert selected rows from table_source
to table_target
using SQL in MySQL where:
- Both tables have the same schema
- All columns should transfer except for the auto-increment
id
- Without explicitly writing all the column names, as that would be tedious
The trivial INSERT INTO table_target SELECT * FROM table_source
fails on duplicate entries for primary key.