Note on subqueries:
1) Subqueries must be enclosed in parentheses;
2) The subquery should be placed on the right side of the comparison condition;
3) A single-line operator corresponds to a single-line subquery, and a multi-line operator corresponds to a multi-line subquery;
1. Single row subquery:
2. Use the group function in a one-line function:
3. Having statement in subquery: For the difference between where and having, please refer to --> Difference between where and having in Oracle
Multi-line comparison operators:
operator | meaning |
IN | equal to any value in the list |
ANY | Compare with any value returned by the subquery |
ALL | Compare with all values returned by the subquery |
5. Use ANY in multi-line subquery: query employee information with higher salary than any employee in department 10
6. Use ALL for multi-line subquery: query the information of employees whose salary is higher than that of all employees in No. 10 department
7. Use in for multi-line subqueries: query information about employees who are not leaders
※ Unselected row: Indicates that there is no data that meets the conditions