一個例子講通Oracle All子查詢,例子通oracleall

來源:互聯網
上載者:User

一個例子講通Oracle All子查詢,例子通oracleall

問題:
查詢出比所有銷售人員的工資都高的員工姓名,工作,工資。

分析:
ANY可以表示任意的,但這個問題要求比所有銷售人員工資都高,那麼就要使用另外一個關鍵字ALL。
ALL與關係操作符一起使用,表示與子查詢中所有元素比較。

代碼示範:ALL子查詢

<span style="font-size:18px;">SQL> SELECT ENAME,JOB,SAL FROM EMP  2  WHERE SAL>ALL (SELECT SAL FROM EMP WHERE JOB='SALESMAN')  3  /</span>


代碼解析:
>ALL:比子查詢結果中所有值還要大,也就是說,比子查詢結果中最大值還要大。
<ALL表示比最小值還要小。

對於子查詢還可以使用IN和NOT IN操作符進行操作。

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.