Oracle- subquery
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