Skip to main content
OnDB supports SQL syntax as an alternative to the query builder. Use client.sql() for SELECT queries and client.sqlInsert() for INSERT statements. Tables are addressed using the app_id::collection format.

SQL Queries

Execute SELECT queries against your collections using client.sql().

Include History

By default, queries return only the latest version of each record. Set includeHistory to true to retrieve all historical versions.

SQL Inserts

Use client.sqlInsert() to insert data with SQL INSERT statements.

SQL Syntax Reference

OnDB supports a subset of SQL syntax. Tables must be referenced in app_id::collection format.

Examples

Response Format

The sql() method returns a SqlQueryResponse:

Next Steps

Query Builder

Fluent query API with type-safe conditions

Predefined Queries

Named, parameterized queries with public endpoints