以下二条语句有什么区别?
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. 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 '%%')
谁能帮帮我吗?
出这个题目的人是不是孔乙己啊
第二个遍历行,再拿出 column1 LIKE '%%'进行匹配,成功在匹配column1 LIKE '%%',直到最后出来结果相同 ,第二个明显效率低。
不過sql有 is not null 來判斷,不曉得猜的對不對
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 件処理されました)
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 '%%')