文件名称:使用子查询解决问题-SQL语言基础
文件大小:5.26MB
文件格式:PPT
更新时间:2024-05-15 13:25:00
SQL 基础
使用子查询解决问题 谁的工资比Jones多? * “哪一位员工的工资比 Jones的薪水高?” 主查询 ? “Jones的薪水是多少?” ? 子查询 * Using a Subquery to Solve a Problem Suppose you want to write a query to find out who earns a salary greater than Jones’ salary. To solve this problem, you need two queries: one query to find what Jones earns and a second query to find who earns more than that amount. You can solve this problem by combining the two queries, placing one query inside the other query. The inner query or the subquery returns a value that is used by the outer query or the main query. Using a subquery is equivalent to performing two sequential queries and using the result of the first query as the search value in the second query.