Postgresql knex.js中的.where()和.whereExists()有什么区别?

Postgresql knex.js中的.where()和.whereExists()有什么区别?,postgresql,knex.js,Postgresql,Knex.js,我相信这是一个同样的问题,好像在问哪里和哪里存在的区别是什么 .where()创建一个where子句,如: select `id` from `users` where `first_name` = 'Test' and `last_name` = 'User' select * from `users` where exists (select * from `accounts` where users.account_id = accounts.id) 此子句用于开始查询的条件部分 .w

我相信这是一个同样的问题,好像在问哪里和哪里存在的区别是什么

.where()
创建一个
where
子句,如:

select `id` from `users` where `first_name` = 'Test' and `last_name` = 'User'
select * from `users` where exists (select * from `accounts` where users.account_id = accounts.id)
此子句用于开始查询的条件部分

.whereExists()
创建一个
whereExists
子句,如中所示:

select `id` from `users` where `first_name` = 'Test' and `last_name` = 'User'
select * from `users` where exists (select * from `accounts` where users.account_id = accounts.id)
此子句测试子查询中是否存在行。在某些情况下,它比使用
JOIN
更快,因为它不会将整个表连接到更高级别的表(在
FROM
子句中)。更多信息请访问

(这些示例查询取自)

披露:我为