Vex · Query DSLLogical operators (
Logical operators (and, or, not)
and and or combine two or more conditions, not negates one, and all three nest. Each compiles to a parenthesized group, so the SQL keeps the structure of the filter. Example: bookings for Friday or Sunday, excluding bookings of one seat.
{
from: ['bookings'],
fields: ['bookings.id', 'bookings.seats'],
filter: {
and: [
{
or: [
{ eq: ['bookings.show_night', '2026-10-23'] },
{ eq: ['bookings.show_night', '2026-10-25'] },
],
},
{ not: { eq: ['bookings.seats', 1] } },
],
},
}CREATE TABLE bookings ( id text PRIMARY KEY, show_night text NOT NULL REFERENCES shows(night), member_id text NOT NULL REFERENCES members(id), seats integer NOT NULL )
SELECT b1.id AS "id", b1.seats AS "seats" FROM bookings AS b1 WHERE ((b1.show_night = '2026-10-23' OR b1.show_night = '2026-10-25') AND NOT (b1.seats = 1)) LIMIT 100
Runs in this page on the installed package. The input and the expected output are defined by the example.