The Query Builder

The Query Builder is a feature of the Data Browser. It generates a SELECT statement for the selected table panel and can hand it straight to the SQL Console for immediate execution — no dialog required. A full dialog is also available for refining the query with joins, column selection, and join types before executing.

The initially generated query always reflects what you see in the selected panel
What you see in the selected panel is what you get — always. Joins toward the root table are INNER JOINs; joins toward child tables are LEFT JOINs.


What is the Query Builder and when should I use it?             
A The Query Builder is a visual tool for constructing SQL SELECT statements. Starting from a subject table you join further tables along their foreign-key associations, select columns, and choose join types. The generated SQL is displayed in real time and ready to copy or execute.

It is most useful when:
  • You want to query across several related tables without writing the JOIN syntax manually.
  • You are exploring an unfamiliar schema and want to see which tables can be joined to the current one.
  • You need a quick starting point that you can then extend with GROUP BY, ORDER BY, or other clauses in the SQL Console.

 
How do I open the Query Builder?
A Both entry points are available from the selected table panel in the Data Browser, via keyboard shortcut or the panel's context menu:

SQL Console (Ctrl+Enter) The most common way. Jailer generates a SELECT statement for the selected table panel and executes it immediately — no dialog required.
Query Builder (Ctrl+Q) Opens the full Query Builder dialog, where you can extend the query with joins to related tables, explicit column selection, and join-type choices before sending it to the console.

 
How do I build a query?
A The dialog is split into two panes. The left pane shows the join tree; the right pane displays the generated SQL.

  1. The subject table appears as the first row in the join tree, labelled From.
  2. To join an additional table, click the + button next to any table in the tree and select the target table from the dropdown. Only tables that have a defined association to the current table are offered.
  3. For each joined table, choose Join (inner) or Left Join from the dropdown on that row.
  4. Tick select columns on any table to include its columns explicitly in the SELECT list. If no table has this box checked, SELECT * is used.
  5. Optionally assign a short alias in the as field. Conflicting aliases are highlighted in red.
  6. The SQL in the right pane updates instantly. When you are satisfied, use one of the buttons at the bottom to copy or execute the query.
 
 
What is the difference between "Join" and "Left Join"?
A Join (inner join) returns only rows where a matching row exists in the joined table. Rows from the parent table that have no counterpart in the joined table are dropped.

Left Join (left outer join) keeps all rows from the parent table, filling the joined table's columns with NULL where no match exists. When a Left Join is used, the distinct keyword is added automatically to avoid duplicate rows caused by one-to-many relationships.
 
 
How do I select specific columns instead of SELECT *?
A Tick the select columns checkbox on any table in the join tree. As soon as at least one table has this box checked, every checked table's columns are listed individually in the SELECT clause, fully qualified with the table alias (e.g. C.ID, C.NAME, O.ORDER_DATE). Tables without the box checked contribute no columns to the explicit list.
 
 
What does the "distinct" checkbox do?
A When checked, SELECT DISTINCT is emitted instead of SELECT, so duplicate rows are removed from the result. The checkbox is set automatically when a Left Join is added, because a one-to-many Left Join would otherwise multiply the parent rows. You can also set or clear it manually at any time.
 
 
How do I use the generated SQL?
A Several buttons at the bottom of the dialog let you use the query:

SQL Console Sends the query to the SQL Console and executes it immediately. Results appear in the console's result grid.
Copy to Clipboard Copies the formatted multi-line SQL to the clipboard.
Copy as Single Line Collapses the SQL to a single line before copying — useful for pasting into tools that do not accept line breaks.
Save Saves the SQL to a file.

 
Can I add ORDER BY, GROUP BY, or LIMIT to the query?
A The Query Builder UI does not have dedicated controls for ORDER BY, GROUP BY, HAVING, or LIMIT. The recommended approach is to click SQL Console to send the generated SQL to the console, and then append the desired clauses there before executing.
 
 
Are there any limitations I should know about?
A A few constraints apply:

  • Single root table. Every query starts from one subject table. All joins must be reachable through defined associations from that root. Arbitrary cross-joins between unrelated tables are not supported.
  • Association-based joins only. The dropdown for adding a table shows only tables that have a defined foreign-key association to the current table in the data model. Tables without such an association cannot be joined through the UI.
  • No per-column WHERE clauses in the UI. Filter conditions are attached at the association level. For more complex WHERE expressions, send the query to the SQL Console and edit it there.