9.过滤查询结果的重复记录

9.过滤查询结果的重复记录
  //查询员工职位类型,过滤重复结果
  select distinct job from emp;
  //查询员工名字和职位,如果名字+职位都相同才过滤
  select distinct ename,job from emp;
  //查询10部门员工从事哪些类型的职位
  select distinct job
  from emp
  where deptno=10;
  //查询2081年入职的员工去了哪些部门
  select distinct deptno
  from emp
  where to_char(hiredate,'yyyy')='2081';
 
  提示:distinct关键对后面所有字段有效,后面所有字段
都相同才认为是重复记录,才会进行过滤。
原文地址:https://www.cnblogs.com/yunman/p/5497513.html