Universal SQL
Not every database DBCode connects to has a SQL engine. Document stores speak query documents, key-value stores speak commands, and API-backed services speak REST. Universal SQL lets you use the SQL you already know against these connections anyway: DBCode parses each statement and translates it into the database’s own operations. A WHERE clause becomes a native filter or an API parameter, ORDER BY becomes a native sort, LIMIT becomes native paging.
The filtering is genuine pushdown. DBCode does not fetch everything and filter rows in the editor; the condition travels to the server, so the database does the work and only matching rows come back.
SELECT name, email, statusFROM customersWHERE status = 'active' AND createdAt >= '2026-01-01'ORDER BY createdAt DESCLIMIT 20;No SQL text reaches the database; the statement runs as a native query.
Each database supports the subset of SQL its engine or API can actually serve, and its own page documents that subset precisely - see Supported Databases. Anything outside the subset is rejected before it runs, with the construct named and its line and column reported, rather than approximated.
The SQL Core
Section titled “The SQL Core”Every Universal SQL connection shares one SQL dialect. A database may serve a subset, but everything inside its subset behaves the same way everywhere.
Statements
Section titled “Statements”| Statement | Notes |
|---|---|
SELECT | Named columns or *, from a single table or collection |
SELECT COUNT(*) | Server-side count |
INSERT | Single row, explicit column list |
UPDATE ... SET | With an optional WHERE |
DELETE | With an optional WHERE |
Filtering with WHERE
Section titled “Filtering with WHERE”| Group | Operators |
|---|---|
| Comparison | =, !=, <>, >, >=, <, <= |
| Pattern | LIKE with %text%, text%, %text, or plain text (exact match); NOT LIKE with %text%; ILIKE (case-insensitive) |
| Membership | IN (...), BETWEEN low AND high |
| Null tests | IS NULL, IS NOT NULL |
| Combinators | AND, OR, parentheses |
SELECT * FROM ordersWHERE status IN ('pending', 'paid') AND total BETWEEN 100 AND 500 AND cancelledAt IS NULL;SELECT * FROM products WHERE name LIKE '%sensor%';Primary key lookups fetch the named records directly:
SELECT * FROM payments WHERE id IN ('pay_001', 'pay_002');Sorting, Paging, and Counting
Section titled “Sorting, Paging, and Counting”ORDER BY, LIMIT, OFFSET, and COUNT(*) are part of the core, executed by the database:
SELECT COUNT(*) FROM sessions WHERE lastSeen >= '2026-07-01';Dates as Plain Strings
Section titled “Dates as Plain Strings”Write dates as ordinary string literals. DBCode types the comparison from what it knows about the column, so '2026-01-01' compared against a date column behaves as a date, not as text:
SELECT * FROM chargesWHERE created BETWEEN '2026-01-01' AND '2026-03-31'LIMIT 100;Comments, Identifiers, and Scripts
Section titled “Comments, Identifiers, and Scripts”- Comments:
--,//,#, and/* ... */are all recognized - Quoted identifiers: wrap a field name in double quotes when it contains spaces or unusual characters, for example
SELECT "unit price" FROM items - Multi-statement scripts: separate statements with semicolons; each statement is translated and executed on its own, and error positions point into the original script
Writing Data
Section titled “Writing Data”Where the database is writable, INSERT, UPDATE, and DELETE translate to the native write operations:
INSERT INTO users (name, email, status) VALUES ('Ada', 'ada@example.com', 'active');
UPDATE users SET status = 'inactive' WHERE email = 'ada@example.com';
DELETE FROM users WHERE status = 'inactive';The same safety net that guards SQL connections guards these: an UPDATE or DELETE without a WHERE clause goes through Missing WHERE Detection, so depending on the connection’s role it asks for confirmation or is denied outright. Read-only connections reject writes.
SQL Alongside the Native Language
Section titled “SQL Alongside the Native Language”SQL does not replace a database’s native language, it sits beside it. Where a connection has its own query language, an editor cell whose first non-comment line starts with SELECT, INSERT, UPDATE, or DELETE runs as SQL; anything else runs in the native language, exactly as before. Native queries and SQL can share the same workflow, and each runs the way it was written.
Supported Databases
Section titled “Supported Databases”| Database | Statements | Highlights |
|---|---|---|
| MongoDB | SELECT, COUNT(*), INSERT, UPDATE, DELETE | Server-side filter, sort, and paging; typed date comparisons; _id strings match ObjectIds automatically |
| Stripe | SELECT | Date ranges, resource equality filters, direct id lookups, and Search API pushdown over the Stripe API |
Each link goes to that database’s Supported SQL reference, which states exactly which statements and filters it serves. More databases adopt the same engine over time.