您好,我想将数据从一个表复制到另一个表,但是我想将varchar列转换为整数列,而表列在下面,我想将pop列转换为整数。谢谢
ea_id int,
yr int,
age varchar,
sex varchar,
eattain varchar,
income varchar,
pop varchar,
--I just created another table and tried loading data like this, my new
--table has a pop data type of integer, I am still getting a syntax error
load data infile 'C:/ProgramData/MySQL/MySQL Server 8.0/Uploads
/file.csv'
into table ca_pop.educ_att
fields terminated by ','
enclosed by '"'
ignore 1 lines
(ea_id, @yr, age, sex, eattain,income, @pop)
set year = YEAR(STR_TO_DATE(@year,'%m/%d/%Y %k:%i'))
set pop =nullif(pop,'')
);