SQL Service中(not)exists与(not)exists结合的用法

例:查询至少购买了“老王”所购买的全部物品的客户的名称

 

 

A (not)exists B (not)exists C

  • exists 与 exists 结合: 

C中只要有一个,对应的A就有

C中全部没有,对应的A才没有

  • not exists 与 exists 结合

C中只要有一个,对应的A就没有

C中全部没有,对应的A才有

  • exists 与 not exists 结合:

C中只要有一个没有,对应的A就有

C中全部有,对应的A才没有

  • not exists 与 not exists 结合:

C中只要有一个没有,对应的A就没有

C中全部有,对应的A才有

 

 

那么对于上述的例题,正确的用法应该是 not exists 与 not exists 结合使用

 

posted @ 2020-05-20 13:19  hentai秃头大叔  阅读(293)  评论(0)    收藏  举报