I have some bulk data in a text file that I need to import into a MySQL table. The table consists of two fields ..
If the table columns do not match, I usually add "bogus" fields with empty data where the real data would've been, so, if my table needs "id", "name", "surname", "address", "email"
and I have "id", "name", "surname"
, I change my CSV file to have "id", "name", "surname", "address", "email"
but leave the fields that I do not have data for blank.
This results in a CSV file looking like this:
1,John,Doe,,
2,Jane,Doe,,
I find it simpler than the other methods.