Skip to content

Query builder

OraclePostgreSQLMySQL

Arrange tables/views and choose fields, joins, filters, aggregates and ordering to build a SELECT visually. The tables below explain each control and how it changes the query. Undo/redo supports design exploration, JSON saving is optional, and execution is always an explicit step.

AI assistance is available for this feature. See the AI assistant guide for details.

Build a SELECT visually from tables and views.
Fictional demo data in the English interface. Existing Oracle/PostgreSQL captures illustrate the shared UI; see the MySQL section for its controls and limits. Available operations also depend on permissions.

Hover over icon buttons to see their tooltips. The builder creates a SELECT from the diagram and grid settings; editing the design does not execute it.

Button / setting How to use / available values What changes
Undo Click the left-curved arrow after changing the design. Restores a previous design state, including fields, conditions, joins and layout. It does not undo database operations. Design history retains up to 100 previous states.
Redo Click the right-curved arrow after Undo. Reapplies the design change you undid. A new design edit starts a different path and clears the redo states.
Load Use the upload/read icon to open a saved query-builder JSON file. Replaces the current design and resets Undo after validation. The file database type must match Oracle, PostgreSQL or MySQL in the current workspace. Loading does not execute SQL.
Save Use the download/save icon and choose a destination; the default filename is query-builder.json. Saves tables, positions, fields, joins, conditions and schema context as JSON for optional reuse. It is not a SQL file or result export, and it does not change database definitions.
Clear Click Clear and confirm the message. Removes all tables, fields and joins from the current design. It does not drop tables or delete database rows. Use Undo if you want to restore the design before another operation resets its history.
Add Choose a schema and Table or View, search by name and browse in pages of 100. Select objects and confirm the addition. Adds cards with the objects’ column names to the canvas. Already-added objects are excluded from duplicate addition. The objects are used as query sources; they are not copied or created in the database.
Execute Finish the design and click the green Execute button. Resolve any displayed validation error first. Runs the generated SELECT and opens Results / logs. See returned rows and the SQL in Execution log; changing the design later does not automatically refresh the result. With tables but no grid fields, SELECT * is generated.
Ask AI Add at least one table/view, enable the provider in AI Settings, then click the AI button. Prepares the selected sources’ definitions and the current design for the AI sidebar. A valid proposal is reviewed before applying; it is not executed automatically. Detailed steps follow below.

Source cards occupy the upper canvas; output fields and settings occupy the lower Design grid. You can resize their areas by dragging the divider.

Button / setting How to use / available values What changes
Move a source card Drag the card header. Changes the visual layout and saved card position. It does not change join direction or the meaning of the query.
Add a field Double-click a column in a source card, or drag it into the lower Design grid. Adds a field with Show checked and no aggregation, sort or filter. The same source column is not added twice through this action.
Select several columns Use Ctrl to toggle columns; Shift selects a range in the same card. Drag the selected columns to the grid together. Adds the selected columns without repeatedly dragging one at a time. Selecting a column alone does not add it to the output.
Draw a join Drag one source column onto a column in another card. Start with one selected column for clarity. Creates an equality join, initially INNER. Check the table/column pair and join type in Join conditions. It does not create a foreign-key constraint.
Remove a source card Click × in the source card header. Removes that source and its dependent fields and joins from the design. The underlying table/view remains in the database.
Schema selection (PostgreSQL) Choose the schema from the selector in the PostgreSQL builder. You can also choose a schema in Add. Updates the builder’s schema selection. Existing cards retain their schema-qualified names; selecting a different schema does not replace them with similarly named tables.

Each vertical field column has an origin, aggregation, sort, Show, Condition and OR setting. These settings jointly determine the generated SELECT, WHERE, GROUP BY and ORDER BY.

Button / setting How to use / available values What changes
Field / table Read the column name and source name at the top of each field. To use a different source column, remove the field and add the intended one. Identifies which table/view supplies the value. These labels are not free-form expression or alias editors.
Aggregation Choose None, Grouping, SUM, COUNT, MAX, MIN or AVG. Changes the selected expression or grouping. Choosing an aggregate automatically groups other shown, non-aggregated fields. Check all fields when changing or removing aggregation.
Sort Choose None, ASC or DESC. For several sort keys, order the fields from left to right by priority. Adds ORDER BY; an aggregated field sorts by the aggregated value. Without explicit ordering, row order is not guaranteed.
Show Check to include a field in the result; uncheck to use it only for supported filtering/sorting/grouping. Controls the SELECT output, not whether the field exists in the design. If fields are present, at least one must be shown; hiding all fields is a validation error.
Condition Enter the part after the column name, for example >= 200, = ‘PAID’, LIKE ‘%Tokyo%’, IN (‘PAID’, ‘PENDING’) or IS NULL. Adds a WHERE condition on the source column. Include operators and quote string literals yourself. Conditions on different fields are joined with AND.
OR Enter an alternative condition for the same field, such as = ‘PENDING’ after Condition = ‘PAID’. Produces (column = ‘PAID’ OR column = ‘PENDING’). It does not OR the whole row of conditions across unrelated fields.
Reorder / remove fields Drag a grid field horizontally to change its position; use its × button to remove it. Changes output-column order and sort-key priority. Removing a field also removes that field’s filtering/sorting/grouping settings; it does not drop the database column.

Filters apply to source rows before aggregation. COUNT is COUNT(column), not COUNT(*), and ignores NULL values. HAVING is not available in this grid.

Button / setting How to use / available values What changes
None Leave aggregation unset on the field. Selects the original column. If another field introduces aggregation, shown non-aggregate columns are grouped.
Grouping / GROUP BY Select Grouping for a key such as customer name or category. Returns a group for each distinct combination of grouping values. Grouping several columns makes the grouping more detailed.
SUM Choose SUM for a suitable numeric column, such as order amount. Computes the sum within each group. Join multiplication can inflate the sum, so check the join’s row relationships.
COUNT Choose COUNT on a column whose non-NULL values you want to count. Counts non-NULL values per group. In a LEFT join, counting a right-hand key can show 0 when there is no matching record.
MAX Choose MAX on the value to compare. Returns the maximum non-NULL value in each group, according to database type and comparison rules.
MIN Choose MIN on the value to compare. Returns the minimum non-NULL value in each group.
AVG Choose AVG on a suitable numeric column. Computes the average over non-NULL values per group. NULL rows do not count as zero.

Use the Join conditions tab to review each pair. “Table 1” and “Table 2” identify the join’s configured ends; they are not determined by which card happens to be drawn on the left or right.

Button / setting How to use / available values What changes
Table 1/column → Table 2/column Select the two sources and their corresponding columns, for example CUSTOMERS.ID and ORDERS.CUSTOMER_ID. Generates an equality comparison in ON. Check the meaning and types yourself; similarly named columns are not necessarily related.
INNER Choose Inner join. Returns only rows that match on both sides. Unmatched records are omitted.
LEFT Choose Left outer join to keep all rows from Table 1. Keeps Table 1 rows and uses NULL for unmatched Table 2 values. A WHERE condition on Table 2 may still remove those unmatched rows.
RIGHT Choose Right outer join to keep all rows from Table 2. Keeps Table 2 rows and uses NULL for unmatched Table 1 values. Review filtering on the optional side.
Multi-column join Add another column pair between the same two tables and use a consistent join direction/type. Combines the equality comparisons with AND in one ON clause. Conflicting join types for the same pair are rejected.
Unconnected sources Check that every intended relationship is represented before Execute. Independent source groups become CROSS JOINs, producing combinations of their rows. A missing join can greatly increase row counts and totals.
Remove a join Use the trash icon on the join row. Removes that design condition. It does not drop a database constraint; removing the last link can turn sources into a CROSS JOIN.
  1. Enable and configure the provider in AI Settings. Add the tables/views the query may use; the AI button requires at least one source.
  2. Click the builder’s AI button. The app retrieves fresh definitions, column types/comments and the current design, then opens the sidebar. Row data is not part of this prepared reference package.
  3. Describe the desired output, filters, totals, sorting and which unmatched records should remain. Add exact column names when comments or logical names are ambiguous.
  4. Optionally use Preview request, then click Send. If the AI asks a clarification question, answer it before expecting a design proposal.
  5. A valid structured answer opens a before/after review. Read the SQL and settings, then choose Apply to design or Discard.
  6. After applying, check the design and click Execute yourself. Applying the proposal does not run SQL.

The review shows before/after SQL and expandable table/field/join/condition settings. The response must reference existing columns in the sources you provided and fit the builder’s supported settings. Plain explanations or clarification questions do not replace the design. Before applying, the app reads definitions again; if the design or reference definitions changed, request a fresh proposal. Applied settings can be revised manually or undone through design history. AI receives context supplied by MonaBase, not direct database access.

Assuming CUSTOMERS and ORDERS with a customer key, customer name, order status and numeric amount: “Join customers to orders on the customer key. Show customer name and SUM of amount for PAID orders, grouped by customer name and sorted by the sum descending. Include only customers with matching orders. Use only the sources already added; ask if a column is unclear.” After applying, verify the INNER join, the status condition, customer-name grouping, SUM and DESC. If several customers share a name, add a customer identifier to the grouping to keep them separate.

For STATUS, set Condition = ‘PAID’ and OR = ‘PENDING’. For AMOUNT, set Condition >= 200. The combined filter means (STATUS = ‘PAID’ OR STATUS = ‘PENDING’) AND AMOUNT >= 200. If AMOUNT also uses SUM, the filter still removes individual rows below 200 before summing; it does not mean SUM(AMOUNT) >= 200. Aggregated-result filtering needs HAVING in a SQL window.

After Execute, open Results / logs to inspect rows, errors and the generated SQL in Execution log. The normal result controls include transpose, cell inspection and clipboard/CSV/Excel export of fetched results. History can open executed SQL in a SQL window. There is no always-visible SQL editor in the design canvas: manual SQL work or plan-based tuning belongs in a SQL window, while AI proposals show SQL in their review dialog. Redesigning the query does not rerun it or refresh existing rows.

The builder supports equality joins (INNER/LEFT/RIGHT), multiple keys between a pair and independent join groups. Self-joins using repeated copies of the same source, cyclic joins, HAVING, subqueries in conditions and arbitrary expression editing are outside this UI. Invalid designs show an error instead of executing guessed SQL. For advanced queries, take executed SQL from the log/history and continue in a SQL window. Saving a builder JSON is optional and is separate from saving .sql text.

  1. Use Add to choose a schema and tables or views. Search and browse the selector in pages of 100 objects.
  2. Add fields and configure joins, filters, grouping and ordering using the tables above. Review the AI before/after dialog when using a proposal; executed SQL is available in Execution log.
  3. Click Execute and inspect the rows and log. Use configured AI support to request a reviewed design proposal, or optionally load/save JSON to reuse the layout.

All screen guides · Read the manual