题目如下:
emp员工表
id name
1  a
2  b
3  c
4  dsext性别表 
1 '男'
4 '女'求没有填写性别的员工。本人只会一种。select distinct name 
  from emp e, sext s
    where e.id not in (select id from sext);这一种应该是条件查询,不知道所谓另一种oracle方式是什么。

解决方案 »

  1.   

    -- 方法一:
    select t1.id, t1.name
    from emp t1
    where t1.id not in (select id from sext t2);-- 方法二:
    select t1.id, t1.name
    from emp t1
    where not exists (select 1 from sext t2 where t2.id=t1.id);
      

  2.   

    select id from emp 
    minus
    select id from sext 
      

  3.   

    oracle中有求差集的函数minus
    select * from tab1 minus select * from tab2
    --取出tab1中有的而tab2中没有的结果(亲~不包括重复行哦!,另外,注意抽出的列要相同哦)--另外其他操作结果集其他函数一起学习哈!
    union            --不解释,鬼都知道
    union all     --同上
    intersect    --求交集
    minus            --求差集(这样说对吧?-_-)
      

  4.   

    -- 方法一:
    select t1.id, t1.name
    from emp t1
    where t1.id not in (select id from sext t2);-- 方法二:
    select t1.id, t1.name
    from emp t1
    where not exists (select 1 from sext t2 where t2.id=t1.id);--方法三:
    select t1.*
    from emp t1,sext t2
    where t1.id=t2.id(+) and t2.id is null
      

  5.   

    select * from sex left join emp
    on sex.id = emp.id
      

  6.   

    1. not in
    2. not exists
    3. minus
    4. 外连接+性别为null