TotalApp Docs

Visual Query Builder

Build SELECT queries by clicking — no SQL required.

Overview

The Visual Query Builder lets you construct SELECT queries through a point-and-click interface. Choose a table, pick the columns you want, add filter conditions, configure joins with other tables, and set sort order and row limits. The generated SQL appears in a live preview pane and updates as you make changes — copy it to your clipboard or run it directly against a connected database.

No SQL Knowledge Required

The Query Builder is designed so that anyone who understands their data model can build a correct SELECT query without writing a single character of SQL. Advanced users can still edit the generated SQL directly in the preview pane.

Building a Query — Step by Step

Pick Table
Select Columns
Add Filters
Add JOINs
Copy / Run

Step 1 — Pick a Table

Click the Select Table dropdown in the left panel. Tables are listed from the schema you imported (or from the connected database). Selecting a table populates the column list below it.

Step 2 — Select Columns

Each column is shown with a checkbox. Check the columns you want in the SELECT clause. The Select All shortcut at the top checks all columns at once. Reorder selected columns by dragging them in the "Selected Columns" list on the right.

Step 3 — Add WHERE Filters

Click + Add Filter below the column list. Each filter row has three parts:

  • Column — a dropdown of all columns from the selected table (and joined tables if any).
  • Operator — chosen from the list appropriate for the column type (see WHERE Filters section).
  • Value — a text input or date picker, depending on the column type.

Multiple filter rows are combined with AND by default. Click the AND badge to toggle it to OR for that condition.

Step 4 — Set ORDER BY and LIMIT

In the Sort & Limit panel, choose a column to sort by, select ASC or DESC, and optionally enter a LIMIT value (e.g. 100).

Step 5 — Copy or Run

The generated SQL is shown in the SQL Preview panel. Click Copy SQL to copy to clipboard, or click Run Query if a database connection is active.

WHERE Filters

The available operators depend on the column's data type.

Column TypeAvailable Operators
String / Textequals, does not equal, contains, does not contain, starts with, ends with, is null, is not null
Integer / Decimal=   ≠   <   <=   >   >=   between, is null, is not null
Date / Timestampequals (date), before, after, between, in last N days, is null, is not null
Booleanis true, is false, is null, is not null
UUIDequals, is null, is not null, in list (comma-separated)
Enumequals, does not equal, in list (multi-select)

Grouped Conditions

Click Group Filters to wrap the current set of filter rows in parentheses in the generated SQL. Add another group and the two groups will be combined with OR, producing queries like WHERE (a = 1 AND b = 2) OR (c = 3).

JOINs

Click + Add JOIN in the Join panel to add a table join to the query.

  1. Select the join type: INNER JOIN, LEFT JOIN, RIGHT JOIN, or FULL OUTER JOIN.
  2. Select the target table to join.
  3. Select the join condition: left column, operator (usually =), right column.
  4. The join target table's columns are now available in the column selector and filter dropdowns.

INNER JOIN

Returns rows where the join condition is met in both tables. Most common join type for fetching related data.

LEFT JOIN

Returns all rows from the left table plus matching rows from the right. Unmatched right-side values are NULL.

FULL OUTER JOIN

Returns all rows from both tables. Unmatched values on either side are NULL. Not supported by all databases.

Generated SQL

The SQL Preview panel shows the current query in formatted SQL, updated live with every change you make in the builder. The generated SQL uses the same formatting rules as the SQL Formatter (2-space indent, UPPERCASE keywords).

You can edit the generated SQL directly in the preview pane. Manual edits are preserved as long as you do not make further changes in the builder panels (which would regenerate the SQL from the builder state).

Running Queries

If a database connection is configured (via Settings → Database Connection), you can run the query directly and see results in a table below the SQL preview.

  • Results are shown in a paginated table — 50 rows per page by default.
  • Columns are sortable by clicking the header.
  • Export the results as CSV or JSON using the export buttons above the result table.
  • Query execution time is shown in milliseconds at the top of the results panel.

SELECT Queries Only

The Visual Query Builder generates and runs SELECT queries only. INSERT, UPDATE, DELETE, and DDL statements are not supported. Use the Database Manager in Developer Tools for write operations.

AI Assistant

Open the built-in AI Assistant from the tab on the right edge of the screen to get help building your query. The assistant sees the current FROM entity, selected columns, JOINs, WHERE filters, ORDER BY clauses, LIMIT/OFFSET, and the live generated SQL, so you can ask things like:

  • "Explain what the generated SQL will return"
  • "How do I add a JOIN to bring in related data?"
  • "Do you see any issues with the current query?"
  • "How can I make this query more efficient?"

The assistant does not execute the query or see real results — it reasons over the current builder state and the generated SQL text shown on screen.

FAQ

Can I save queries for later use?
Yes. Click Save Query in the toolbar to save the current builder state with a name. Saved queries appear in the Saved Queries panel on the left. Click a saved query to restore the builder state. Saved queries are stored locally in the server-backed JSON store and persist across sessions.
Does the builder support subqueries?
The visual builder does not support nested subqueries in the GUI. However, you can edit the generated SQL directly in the preview pane and add a subquery manually. The Run Query button works on the edited SQL regardless of whether the builder panels reflect it.
Where does the table list come from?
The table list is populated from whichever schema was most recently imported — either from a DDL paste in Schema Visualizer, a database connection, or a JSON schema import. If the list is empty, open Schema Visualizer and import a schema first.
Can I use aggregate functions like COUNT or SUM?
Yes. When selecting a column, click the function icon next to it to wrap it in an aggregate function: COUNT, SUM, AVG, MIN, or MAX. Adding an aggregate automatically adds a GROUP BY clause for all non-aggregate columns in the query.