简体   繁体   中英

mysql query returns “0 rows inserted”

I am trying to upload csv file into mysql database, but 0 row was inserted using the following query. I wonder where should I start looking at the problem

LOAD DATA LOCAL INFILE "/Applications/xxx/tmp/student_info.csv" INTO TABLE student_info_table
CHARACTER SET utf8
FIELDS TERMINATED BY ',' 
LINES TERMINATED BY '\n'
(name,age,grade) ;

I found the problem is actually in the setup of my database table. It has a foreign key, and in the uploading file, I did not define a valid foreign key value

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM