十五
高级查询2
exists 子查询;
1.用exists检测表是否已经创建
drop table if exists info
create table info(
#省略建表语句

2.select 字段名 from info where exists(子查询)
子查询有返回结果:exists子查询结果为true
子查询无返回结果:exists子查询结果为false,外层查询不执行
3.exists只对子查询进行结果判定,不影响最终结果
子查询注意事项:
1.子查询语句可以嵌套在SQL语句中任何表达式出现的位置
2.只出现在子查询中而没有出现在父查询中的表不能包含在输出列中

相关文章:

  • 2022-12-23
  • 2021-07-24
  • 2021-05-13
  • 2021-04-23
  • 2021-06-21
  • 2021-04-11
  • 2021-04-30
  • 2021-11-16
猜你喜欢
  • 2021-07-06
  • 2021-08-05
  • 2021-05-09
  • 2021-07-21
  • 2021-04-19
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案