sql 中的exists代表什么意思

Exists 方法 描述如果在 Dictionary 对象中指定的关键字存在,返回 True,若不存在,返回 False。
举个例子吧:
select * from a where exists(select * from b where a.id = b.id);
a表和b表使用id关联,这条语句的含义是,当b表能够查询出结果时,exists(select * from b where a.id = b.id)子句为真,只有满足exists结果为真时,才会查询出a表的记录。

猜你喜欢

转载自blog.csdn.net/Interesting_Talent/article/details/81359170