NotExists
Negated sub-query existence test (not exists (query)). Extends Exists.
Shorthand key: !exists (special-cased in the object-literal shorthand, not a suffix).
Constructor
NotExists(query: Select | Raw): NotExists
new NotExists(query: Select | Raw): NotExists
Dual-callable, same argument shape as Exists.
import { NotExists, Eq, Field, Select } from '@sqb/builder';
const hasOrders = Select().from('orders').where(Eq('customer_id', Field('customers.id')));
Select().from('customers').where(NotExists(hasOrders));
// where not exists (select * from orders where customer_id = customers.id)
Properties
Inherits every property from Exists (_type, _left, _symbol, _isArray);
_symbol is always 'not exists'.
Methods
Inherits ._serialize() from Exists; NotExists adds no
methods of its own.
Object-literal shorthand
Select().from('customers').where({ '!exists': Select().from('orders') });
// where not exists (select * from orders)