Get the App
SLTechnology News&Howtos  ›  Database  › 

Oracle- subquery

Shulou Source: shulou.com Published: 2022-06-01 15:00:09 10月03日 Update

1. Subquery in WHERE condition

1. What are the employees who earn more than black?

Select ename

From emp

Where sal > (select sal from emp where ename='BLAKE')

two。 What are the employees with a maximum wage higher than 30 departments?

Select ename,sal

From emp

Where sal > (select max (sal) from emp where deptno=30)

Select ename,sal

From emp

Where sal > all (select sal from emp where deptno=10);-any

3. When all is followed by a subquery

"x = ALL (...)": The value must match all the values in the list to evaluate to TRUE. All values must match

"x! = ALL (...)": The value must not match any values in the list to evaluate to TRUE. At least one value does not match.

"x > ALL (...)": The value must be greater than the biggest value in the list to evaluate to TRUE. Greater than the maximum value

"x

< ALL (...)": The value must be smaller than the smallest value in the list to evaluate to TRUE.小于最小的值 "x >

= ALL (...) ": The value must be greater than or equal to the biggest value in the list to evaluate to TRUE. Greater than or equal to the maximum value

"x ANY (...)": The value must be greater than the smallest value in the list to evaluate to TRUE. Greater than the minimum

"x

< ANY (...)": The value must be smaller than the biggest value in the list to evaluate to TRUE.小于最大值 "x >

= ANY (...) ": The value must be greater than or equal to the smallest value in the list to evaluate to TRUE. Greater than or equal to the minimum value

"x

Tags: Salary minimum result department employee query maximum time sort maximum maximum association same clause rare that is conditions items characteristics questions Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Tech Info OPPO Reno NVidia Huawei Docker