Oracle minus 操作符使用手记

阅读更多
最近做一个简单的oracle sql测试系统,其中要用minus比较两个语句的结果集是否相同,最后发现minus操作符对
order by 有限制,无奈求助google无门,就去oracle论坛求助,果然高手如云啊,感到老外回答问题的专业性和热情
让人不得不佩服,下面是例子,大家一看就明白!!
 
 
SQL> select deptno from dept order by deptno
  2  minus
  3  select deptno from emp order by deptno;
minus
*
ERROR at line 2:
ORA-00933: SQL command not properly ended
 
 
SQL> ed
Wrote file afiedt.buf
 
  1  select * from (select deptno from dept order by deptno)
  2  minus
  3* select * from (select deptno from emp order by deptno)
SQL> / 
 
    DEPTNO
----------
        40
 
SQL>

你可能感兴趣的:(Oracle,SQL,Google)