I'm trying to import a CSV file into MySQL (using Workbench) using the query found here:
LOAD DATA INFILE 'badBDay.csv'
INTO TABLE user_birthdays
FIELDS TERMINATED BY ','
LINES TERMINATED BY '\n'
(username, user_birthday)
The problem is, there are rows in the file that do not have data for both columns (i.e. some are missing a birthday.)
Here's the table CREATE statement that MySQL exported:
CREATE TABLE `user_birthdays` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`username` varchar(150) DEFAULT NULL,
`user_birthday` varchar(45) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `id_UNIQUE` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=65536 DEFAULT CHARSET=utf8$$
How can I load my file in if there are records that don't contain a value for all columns?
UPDATE
Here are a few sample rows; I did find that there was one row that was completely blank; I removed that and the error goes away, but the table still doesn't seem to be populating at all. (And yes, in some cases the username is numeric; this is just from the top of the alpha-sorted file. There are more that have "real" usernames.)
109,12/24/1979
124,03/31/1987
142,11/30/1965
143,
233,11/03/1970
311,
321,07/08/1971