Simple WHERE Clauses​
The where
method is used to add a WHERE clause to the query, it's an alias for and
which can be called multiple times
to add multiple AND conditions to the WHERE clause, whilst or
can be used to add an OR condition.
Array Expansion​
Arrays embedded in SQL Fragments are expanded into a list of parameters, this can be used to create IN clauses.
WHERE with Subqueries​
Fragments can embed other fragments where their SQL and parameters are merged.
Subqueries with Query Builders​
Similarly, Query Builders and SQL Fragments can be embedded in other Query Builders to create complex subqueries.
WHERE convenience options​
The where
method can also be called with an object containing a number of convenience options to simplify creating
common queries with an object query. If needed op
can be used to create options for a custom SQL operator.
LIKE convenience options​
The startsWith
, endsWith
and contains
options can be used to create LIKE conditions that match the start,
end or any part of a string.
NULL check convenience options​
Whilst the isNull
and notNull
convenience options can be used to create IS NULL and IS NOT NULL conditions.
Reset WHERE​
Calling where
with no arguments will reset the WHERE clause: