SQL rules and limits
What the query workspace allows, the 1,000-row and time limits, how tables and columns map to your data, and meaning-based search.
Queries run on your live workspace data. The rules protect your data and keep the tool fast.
What is allowed
| Rule | Detail |
|---|---|
| One statement | A single read-only SELECT. Combining queries with UNION, INTERSECT or EXCEPT is fine. WITH (CTEs) and window functions work. |
| Read-only | No inserts, updates, deletes or schema changes. Use records or flows for that. |
| Tables | Use the tables listed in the left rail. Each record type is one table named by its key, such as orders or customers. |
| No qualifiers | Do not write database.table. |
| Quotes | Use 'single quotes' for text. Comments, backslashes and double-quoted strings are not supported. |
| Reserved words | Wrap names like order in backticks: `order`. |
| CTE names | A WITH name cannot reuse a table name. |
Limits
| Limit | Value |
|---|---|
| Rows returned | 1,000. A capped at 1,000 badge shows when the result was cut. |
| Run time | About 5 seconds for the database, within 8 seconds overall. |
What each table contains
- One row per live record. Deleted records are not included.
- One column for each simple field of the record type, plus
idandcreated_at. - Fields that hold lists (multiple choice, several references) are not columns.
- A field your role may not read comes back as empty (
NULL), so totals never leak hidden values. - References are stored as the other record's
id, so you join on it:a.customer = b.id. The Relationships tab on a table shows each join and a Join button that writes it for you.
System tables
Tables from other apps appear under System tables, marked system, when your role can read that app. Examples include work queues, ad campaigns, point-of-sale sales, messages and calendar events. Some columns (message bodies, queue contents) are deliberately left out.
Meaning-based search in SQL
You can rank rows by meaning instead of exact words with EMBED and COSINE.
EMBED('some text')turns a piece of text into a vector. It takes a quoted text literal only, up to 4 per query, up to 2,000 characters each.COSINE(vec, EMBED('...'))scores how close a stored vector is to it. Higher is closer.- The knowledge tables expose vectors:
knowledge_sources(title, collection key, status) andknowledge_chunks(asource_id,seq, and thevecvector). Document text is not available in SQL.
SELECT s.title
FROM knowledge_chunks c
JOIN knowledge_sources s ON s.id = c.source_id
ORDER BY COSINE(c.vec, EMBED('refund policy')) DESC
LIMIT 10
EMBED works in the workspace, in saved queries and widgets, and in AI-generated SQL. Each run counts against your AI use. If meaning-based search is not enabled for your platform the query returns an error. A vector column prints as [vector, N dims].
Error messages
| Message | Meaning |
|---|---|
| could not parse SQL — check the syntax | The text is not valid SQL. |
| only a single read-only SELECT statement is allowed | You wrote something other than one SELECT. |
| query references a table that isn't available — use the listed tables only | A table name is not in your list. |
| comments, backslashes and double-quoted strings aren't supported — use 'single quotes' | Remove them. |
| a WITH (CTE) name cannot reuse a table's name — rename the CTE | Rename the CTE. |