This guide can be used to insert data into database using select query.
INSERT INTO first_table (column1, column2) SELECT column1, column2 FROM second_table
Using above syntax, all data in second_table will be copied into first_table.
You can also add where keyword.
INSERT INTO first_table (column1, column2) SELECT column1, column2 FROM second_table WHERE id > 1000