Twice recently I have had to import data from a flat file into a
database — both sets of data were being imported to make better
use of the data in the files. Importing a file is not that
difficult using mysqlimport
, particularly since in
both cases the data was tab-delimited. I also could have used
LOAD DATA INFILE
.
The problem with mysqlimport
and LOAD DATA
INFILE
is that you need to create the table beforehand.
Often, though, I may not know the exact data types. Folks have
written about PROCEDURE ANALYSE()
, but they use
it in the context of “you can check to see that your tables have
the correct data types.”