文件名称:使用子查询-SQL语言基础
文件大小:5.26MB
文件格式:PPT
更新时间:2024-05-15 13:25:01
SQL 基础
使用子查询 * SQL> SELECT ename 2 FROM emp 3 WHERE sal > 4 (SELECT sal 5 FROM emp 6 WHERE empno=7566); ENAME ---------- KING FORD SCOTT 2975 * SELECT ename FROM emp WHERE sal > (SELECT sal FROM emp WHERE empno=7566); Using a Subquery In the slide, the inner query determines the salary of employee 7566. The outer query takes the result of the inner query and uses this result to display all the employees who earn more than this amount. Instructor Note Execute the subquery (inner query) on its own first to show the value that the subquery returns. Then execute the outer query using the result returned by the inner query. Finally, execute the entire query (containing the subquery) and show that the result is the same.