select num form a where num not in(select num from b)
优化如下:
select num from a where exists(select 1 from b where num =a.num)
delete from acct_item where subs_id not in(select subs_id from subs);
优化如下:
delete from acct_item a where not exists (select 1 from subs b where a.subs_id=b.subs_id )
select * from em where deptno>3;
优化如下:
select * from em where deptno>=4;
select * from kj_dept where dept_id in(select dept_id from kj_dept_info where dept_id =xxx)
优化如下:
select * from kj_dept where exists (select * from kj_dept_info where kj_dept.dept_id = kj_dept_info.dept_id and dept_id = xxx)
select * from employee where salary <>3000;
优化如下:
select * from employee where salary<3000 or salary>3000;
优化如下:
select num from a where exists(select 1 from b where num =a.num)
delete from acct_item where subs_id not in(select subs_id from subs);
优化如下:
delete from acct_item a where not exists (select 1 from subs b where a.subs_id=b.subs_id )
select * from em where deptno>3;
优化如下:
select * from em where deptno>=4;
select * from kj_dept where dept_id in(select dept_id from kj_dept_info where dept_id =xxx)
优化如下:
select * from kj_dept where exists (select * from kj_dept_info where kj_dept.dept_id = kj_dept_info.dept_id and dept_id = xxx)
select * from employee where salary <>3000;
优化如下:
select * from employee where salary<3000 or salary>3000;