0

I have a text file in the following format, which contains about a million coupon codes.

93C9LF,PDF934,24YWJ4
93C9LF,PDF934,24YWJ4
93C9LF,PDF934,24YWJ4

Below is my query

LOAD DATA LOCAL INFILE /var/www/coupons.txt
INTO TABLE coupons
FIELDS TERMINATED BY '' ENCLOSED BY '' ESCAPED BY ''
LINES STARTING BY '' TERMINATED BY ','
(coupon);

When I execute this query only some are inserted into the database. I would like to know what I am doing wrong or what could be done to improve this query.

1 Answer 1

1

Hi Rezaq you can use this:

LOAD DATA LOCAL INFILE '/var/www/coupons.txt' 
INTO TABLE coupons 
FIELDS TERMINATED BY '\t'
ENCLOSED BY ',' 
LINES TERMINATED BY '\n'
(coupon);
Sign up to request clarification or add additional context in comments.

3 Comments

+TERMINATED BY '\t'+ ... shouldn't that be +TERMINATED BY ','+ here? I clearly see a comma as field delimiter in the example above, not a tabulator sign (or other whitespace)
This works totally fine. @BviLLe_Kid. I am loading this into a single column not multiple column.
@Rezaq I wasn't the one who answered the question

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.