Skip to main content

Select Query Builder

The select query builder provides a fluent API for constructing SELECT queries.

from()

Specifies the table or subquery to select from.

where()

Adds a WHERE clause to filter results.

orderBy()

Orders results by one or more columns.

limit()

Limits the number of rows returned.

offset()

Skips a specified number of rows.

groupBy()

Groups results by one or more columns.

having()

Filters grouped results (use with groupBy).

Joins

leftJoin()

Performs a LEFT JOIN.

rightJoin()

Performs a RIGHT JOIN.

innerJoin()

Performs an INNER JOIN.

fullJoin()

Performs a FULL JOIN.

Selecting from Joins

Set Operations

union()

Combines results from multiple queries (removes duplicates).

unionAll()

Combines results from multiple queries (keeps duplicates).

intersect()

Returns rows that appear in both queries.

except()

Returns rows from the first query that don’t appear in the second.

Insert Query Builder

values()

Specifies the values to insert.

select()

Inserts rows from a SELECT query.

onConflictDoNothing()

Ignores conflicts (SQLite: INSERT OR IGNORE).

onConflictDoUpdate()

Updates on conflict (SQLite: INSERT OR REPLACE).

returning()

Returns inserted rows.

Update Query Builder

set()

Specifies the values to update.

where()

Filters which rows to update.

returning()

Returns updated rows.

from()

Updates using joins with other tables.

Delete Query Builder

where()

Filters which rows to delete.

returning()

Returns deleted rows.

orderBy()

Orders rows before deletion (used with LIMIT).

limit()

Limits the number of rows to delete.

Prepared Statements

All query builders support prepared statements for better performance.

prepare()

Creates a prepared statement.

Dynamic Queries

Create conditional queries at runtime.

$dynamic()

Enables dynamic mode for conditional query building.