有一组数据:Apple   OranGe    BananA  等,都是这样大小写混写的一组数据,存在表 fruit中的A列中select A from fruit where a like '%XXX%'
希望 XXX 这个 where 条件可以不区分大小写,比如我在 XXX 处写一个“app”就可以把 Apple 查出来

解决方案 »

  1.   

    LOWER
    select A from fruit where LOWER(a) like '%XXX%' 
      

  2.   

    1楼是正解,只是'%XXX%'好像也得加LOWER 。
      

  3.   


    select A from fruit where instr(upper(a), upper('app'))>0;%XXX% 这样使用不了index,instr(upper(a), upper('app')) 可以建立function index;
      

  4.   

    select A from fruit where LOWER(a) like lower('%XXX%')
    select A from fruit where upper(a) like upper('%XXX%')