登录 注册
当前位置:主页 > 资源下载 > 这个SQL语言基础查询能否正常执行?

这个SQL语言基础查询能否正常执行?

  • 更新:2024-07-07 12:03:20
  • 大小:5.26MB
  • 推荐:★★★★★
  • 来源:网友上传分享
  • 类别:Informix - 数据库
  • 格式:PPT

资源介绍

这个查询能正常工作么? * no rows selected 子查询不返回任何值 SQL> SELECT ename, job 2 FROM emp 3 WHERE job = 4 (SELECT job 5 FROM emp 6 WHERE ename='SMYTHE'); * SELECT ename, job FROM emp WHERE job = (SELECT job FROM emp WHERE ename='SMYTHE'); Problems with Subqueries A common problem with subqueries is no rows being returned by the inner query. In the SQL statement on the slide, the subquery contains a WHERE (ename='SMYTHE') clause. Presumably, the intention is to find the employee whose name is Smythe. The statement seems to be correct but selects no rows when executed. The problem is that Smythe is misspelled. There is no employee named Smythe. So the subquery returns no rows. The outer query takes the results of the subquery (null) and uses these results in its WHERE clause. The outer query finds no employee with a job title equal to null and so returns no rows.