文件名称:子查询语句-SQL语句培训文档
文件大小:539KB
文件格式:PPT
更新时间:2024-05-15 15:56:26
SQL语句 培训
1、子查询语句 In 语句: SELECT * FROM Employee WHERE dp_id IN (SELECT DP_ID FROM Department WHERE UP_DEPID=0) 说明:查询部门编号为0(工程技术部)下级部门的人员。 EXISTS语句: SELECT * FROM Employee A WHERE EXISTS (SELECT DP_ID FROM Department B WHERE UP_DEPID=0 AND A.dp_id=B.dp_id); 说明:和In语句查询出的结果一样,该语句查询的效率大大优于In语句。 *