|
在mysqldb中成功导入.csv在文件的内容之后,我遇到了一个奇怪的问题。csv成功导入文件中的数据db但是如果我在表上有条件的话SQL查询结果不会返回。我可以操作查询:
- v. a$ c% X# L+ n3 V# [# w Wselect * from mst_question但是,如果条件条件并满足条件,则不会返回任何结果
2 L5 I# |; C* x# tselect * from mst_question where qtype='single'表有行,其中列qtype 包含条件文本single但不返回任何结果。
! n5 S. Z+ ~* c7 E) J奇怪的是,如果我编辑表中的 qtype通过键入 列内容single 替换测试single该行将返回…… 对于我编辑的每一行!7 s8 k( A$ w: i, W
我的.csv文件:
- e0 L* q7 U) M' V/ L2 Gque_id,test_id,que_desc,ans1,ans2,ans3,ans4,true_ans,qtype,11,In which year is the HTML specification supposed to be complete and finalized?,2012,2015,2020,2022,D,single,11,Which of the following doctypes was introduced by HTML5?,,,"","",B,single,11,How do you stop crawlers from following links to sites you don't want to be associated with?," "," "," ","",A,single,11,Which tag is used to define a section of the page that has content that is related but not critical to the main content in HTML5?, , , , ,C,single,11,The is used to contain a main article. What is the tag used to break it into sections?, , , , ,D,single我的LOAD DATA LOCAL INFILE语法:
+ U' _5 T5 f; c ^LOAD DATA LOCAL INFILE 'quest.csv' INTO TABLE mst_question FIELDS TERMINATED BY "," OPTIONALLY ENCLOSED BY """" IGNORE 1 LINES执行LOAD DATA LOCAL INFILE后的输出:7 M3 R: e! `0 d K
(5 row(s)affected)(0 ms taken)我的SQL查询(给出结果):7 K$ F' U( r$ l9 [% m' ]5 F
select * from mst_question结果 :" V7 F& S: H) f
(5 row(s)returned)(0 ms taken)我的SQL查询条件简单(无结果):
+ F/ A& {7 i8 X$ E$ Nselect * from mst_question where qtype='single'结果 :# Z6 z" |" I9 K9 K) m* C
(0 row(s)returned)(0 ms taken)究竟我做错了什么 ?# T8 n3 L. L0 a0 g) Z) j8 d7 E' M
找不到。…请告知…5 L4 }6 P3 L5 V' J6 b- X8 N/ `
* A( z, W8 [ y7 w1 Z 解决方案: |
|