sql - Missing int values when importing from csv into MySQL -


i'm building database works helping students build class schedule. i've "succeeded" in importing 2 of 3 columns using csv file i'm having issues importing id numbers fields classes apart of. think has id being int file, since other 2 columns varchar's. having column int makes rest of project incredibly easy...

a small portion of csv file reads:

1,afam,2000 1,afam,3150 1,psyc,3150 1,afam,3880 1,afam,4200 2,pols,4200 2,afam,4490 2,afam,6490 2,dram,4490 2,dram,6490 2,afam,4500 

then use in mysql:

load data local infile 'course_requirements.csv' table courses fields terminated ',' lines terminated '\n'; 

when go select * courses; view table shows this:

id  |  classname  |  classnumber     |  afam       |  2000     |  afam       |  3150     |  psyc       |  3150     |  afam       |  3880     |  afam       |  4200     |  pols       |  4200     |  afam       |  4490     |  afam       |  6490     |  dram       |  4490     |  dram       |  6490  2  |  afam       |  4500 

i have no idea why ids aren't showing up...

make sure id column in courses not primary key or unique. if not cannot have duplicates. execute:

show create table courses 

and @ properties of id column


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -