Problem:
Find out the names, jobs, and salaries of employees with lower wages in the EMP table than any salesperson ("salesman").
Analysis:
Salespeople have a lot of records in the EMP table, everyone's salary is not equal, if the return "than any employee's salary is lower" condition, return than "maximum wage is lower" can be.
If you do it with a subquery, multiple records are returned in the subquery. Running with normal relationships (>, <, and so on) can be an error.
You need to use the keyword any. Any is placed after the comparison operator, which means "any".
Code Demo: Any subquery
<span style= "FONT-SIZE:18PX;" >SQL> Select Ename,job,sal from emp 2 where Sal<any (select SAL from emp where job= ' salesman ') 3
/</span>
Code parsing:
<any: It is smaller than any value in the subquery result, that is, it is smaller than the maximum value in the subquery result, so the same >any is larger than the smallest subquery result.
An example of an oracle any subquery