INSERT INTO ... SELECT without detailing all columns

Of course, primary key must be unique. It depends on what you want to achieve, but you could exclude rows with a primary key that already exists.

INSERT INTO table_target SELECT * FROM table_source 
WHERE table_source.id NOT IN (SELECT id FROM table_target)

UPDATE: since you also need the extra rows, you should resolve the conflict first, does table_source have relationships? If not you could change those keys:

UPDATE table_source SET id = id + 1000
WHERE id IN (SELECT id FROM table_target)

Where 1000, is a constant, big enough so they go after the end of your table.


Column names have to be specified -

INSERT INTO table_target SELECT NULL, column_name1, column_name2, column_name3, ...
  FROM table_source;

Just pass NULL as a value for the auto-increment id field.


Either you list all of the fields you want in the insert...select, or you use something else externally to build the list for you.

SQL does not have something like SELECT * except somefield FROM, so you'll have to bite the bullet and write out the field names.