以下二条语句有什么区别?
1. select * from table
2. select * from table where column1 LIKE '%%' and column2 LIKE '%%' and (column3 LIKE '%%' or column4 LIKE '%%' or column5 LIKE '%%' or column6 LIKE '%%')
谁能帮帮我吗?

解决方案 »

  1.   

    column1 LIKE '%%' 是什么意思?
      

  2.   

    like '%%' 和like '%' 效果是一样的.我觉得除非table中有字段的值是null,否则两个语句没什么区别.
      

  3.   

    like '%%' 和like '%' 效果是一样的. 我觉得除非table中有字段的值是null,否则两个语句没什么区别.
      

  4.   

    一个会写sql,一个乱写sql
    出这个题目的人是不是孔乙己啊
      

  5.   

    第一个遍历行,直接出来。
    第二个遍历行,再拿出 column1 LIKE '%%'进行匹配,成功在匹配column1 LIKE '%%',直到最后出来结果相同 ,第二个明显效率低。
      

  6.   

    可能寫2的人的初衷是想要: column1和column2不為null,同時column3-6至少有一列不為null ?
    不過sql有 is not null 來判斷,不曉得猜的對不對
      

  7.   

    create  table zhiji(支給年月 char(6), 職員番号 char(10))
    insert into zhiji
    select '200609','0000000001' union
    select '200610','0000000001' union 
    select '200611','0000000001' union
    select '200612','0000000001' create  table  duixiang (対象年度 char(4),対象年月 char(6),職員番号 char(10),対象年月日 char(8))
    insert into duixiang
    select 2005, 200608,'0000000001','19910101' union
    select 2006, 200606,'0000000001','19910101' union
    select 2006, 200607,'0000000001','19910101' union
    select 2006, 200610,'0000000001','19920101' union
    select 2006, 200612,'0000000001','19930101' union
    insert into duixiang values( 2006,null,'','')
    select * from duixiang
    select * from duixiang where 対象年度 like'%%' and 対象年月 like'%%' and(職員番号 like '%%' or 対象年月日 like '%%')
    対象年度 対象年月 職員番号 対象年月日
    2005 200608 0000000001 19910101
    2006 200606 0000000001 19910101
    2006 200607 0000000001 19910101
    2006 200610 0000000001 19920101
    2006 200612 0000000001 19930101
    2006 200612                    
    2006                    (7 件処理されました)対象年度 対象年月 職員番号 対象年月日
    2005 200608 0000000001 19910101
    2006 200606 0000000001 19910101
    2006 200607 0000000001 19910101
    2006 200610 0000000001 19920101
    2006 200612 0000000001 19930101
    2006 200612                    (6 件処理されました)
      

  8.   

    create  table  duixiang (対象年度 char(4),対象年月 char(6),職員番号 char(10),対象年月日 char(8))
    insert into duixiang
    select 2005, 200608,'0000000001','19910101' union
    select 2006, 200606,'0000000001','19910101' union
    select 2006, 200607,'0000000001','19910101' union
    select 2006, 200610,'0000000001','19920101' union
    select 2006, 200612,'0000000001','19930101' 
    insert into duixiang values( 2006,null,'','')
    insert into duixiang values( null,2006,'','')
    insert into duixiang values( 2006,2006,null,'')
    insert into duixiang values( 2006,2006,'',null)
    insert into duixiang values( 2006,2006,null,null)select * from duixiang
    select * from duixiang where 対象年度 like'%%' and 対象年月 like'%%' and(職員番号 like '%%' or 対象年月日 like '%%')
      

  9.   

    column1 LIKE '%%'  等价于column1  is not null