I have some very large files (millions of records) that I need to load into a database. They are of the form:
word1\tblahblahblah
word2\tblahblah
word3\tblahblah
word4
word5\tblahblah
...
My problem, is that I want to ignore the lines that have no second record (the 'blahblah's'), like word4.
I'm currently using the following query to load the file:
LOAD DATA LOCAL INFILE 'file'
IGNORE INTO TABLE tablename
COLUMNS TERMINATED BY '\t'
LINES TERMINATED BY '\n'
(col1, col2);
This has the functionality I want, except that it still accepts the null values. Is there a way to skip the word4 type lines and not add them to the DB?
Intuitively, I thought using a WHEN or WHERE clause would be perfect, but looking through documentation and other info online, I can't find any examples where this would work. Am I forced to filter these records out before hand, or can I do it within this query?
Any help is grealy appreciated!