Created a new table using the following:
LOAD DATA LOCAL INFILE 'C:/ProgramData/MySQL/MySQL Server 8.0/Uploads/new_tbl_1.csv'
INTO TABLE tbl_1
FIELDS TERMINATED BY ','
OPTIONALLY ENCLOSED BY '"'
LINES TERMINATED BY '\n'
IGNORE 1 ROWS
I've found that I can't join on the final column of this table because there is an additional character being added.
For example if I check length(field_1)
on a record that says 'Blue', it will return a length of 4, unless it's the last field in the table, in which case it returns a length of 5.
When copying the visible record and pasting into a spreadsheet, it pastes like this:
'Blue\r'
Am I uploading incorrectly? How can I account for this line break so that it doesn't break the JOIN
?
As comments have pointed out, on windows, instead of: LINES TERMINATED BY '\n'
it requires the additional \r
like: LINES TERMINATED BY '\r\n'