Visual SQL Query Builder
The Visual SQL Query Builder is a point-and-click canvas for assembling SELECT statements. Each table in the query is a card on the canvas, joins are drawn as lines between them, and filters and sorting live in a panel on the right. The generated SQL updates live underneath as you work. When you're happy, hit Run Query to see the results in the same tab, or switch to SQL and keep editing by hand.
The builder belongs to a table's query tab, so it always starts from a specific table. Open the table, then click Query Builder in the toolbar (next to SQL). The builder fills the tab: the canvas on the left, the Where and Order By panels on the right, and the Generated SQL and Results tabs along the bottom. The header shows how many tables are in the query, with buttons to shrink the builder back down or close it.
Switching back to SQL keeps the builder's state — return to it later and your tables, joins, and conditions are still there. Edit as SQL copies the generated query into the SQL editor so you can carry on by hand.
Drag a card to move it, drag the empty canvas to pan, and scroll to zoom. The controls in the bottom-left corner zoom in and out, show the current zoom level, fit every card on screen, and tidy the cards into a clean layout.
Until you pick any columns, the query returns every column of the current table. To choose the output yourself, use the buttons on each table card:
SELECT one after another.Join columns are marked with a key icon, and the remove button next to a field takes it back out of the SELECT.
The Where panel holds your conditions. Each condition row has three parts:
| Operator | Meaning | Value input |
|---|---|---|
=, != | Equality / inequality | Single value |
>, <, >=, <= | Numeric / date comparisons | Single value |
BETWEEN | Range (inclusive) | From and to values |
IN, NOT IN | Value in a list | Comma-separated list |
LIKE, NOT LIKE, ILIKE | Pattern match (ILIKE ignores case) | Pattern with % / _ |
IS NULL, IS NOT NULL | Presence check | None |
Conditions in a group are combined with And; switch the group's dropdown to Or to change that. + Group adds a nested group with its own And/Or, + Expression adds another condition, and you can drag conditions to reorder them. The check mark at the start of a row turns a condition off without deleting it.
Click Join table in the top-left corner of the canvas to add another table. VisuaLeaf reads the foreign keys in your schema, so the list puts related tables first and tells you how each one would connect.
Example: with orders as the current table, the list offers customers via customers.customer_id = orders.customer_id and addresses via addresses.address_id = orders.shipping_address_id. Pick one and the card arrives already joined on that condition. Tables with no foreign key to the query are listed after the related ones.
Each joined card carries its join settings at the top:
INNER JOIN, LEFT JOIN, RIGHT JOIN, FULL OUTER JOIN, or CROSS JOIN, and which table it joins to.=. The line on the canvas follows the columns you pick.Hover the + next to a field on a card to wrap it in an aggregate:
COUNT, COUNT DISTINCTSUM, AVGMIN, MAXAs soon as one field is aggregated, every other field is marked GROUP and goes into the GROUP BY clause for you. A Having panel also appears on the right for filtering on aggregated values. Click an aggregate badge to remove it.
Click + Add Sort in the Order By panel, pick a column, and choose ascending or descending. Add more sorts for tie-breakers; the counter next to the heading shows how many are set. How many rows come back per page is set in the results grid, the same way as for any other query.
The Generated SQL tab under the canvas shows the query as you build it, and updates on every change. While the Results tab is open, the generated SQL stays visible on a single line beside the tabs, so you can always check what will run.
Two ways to take the query further:
Reset clears the builder back to just the current table.
orders table and click Query Builder.customers (via customers.customer_id = orders.customer_id). Set the join type to INNER JOIN.customers card, click + Add field and add email.orders card, add total and set its aggregate to SUM. email is now marked GROUP.SELECT "customers"."email", SUM("orders"."total")
FROM "market"."orders"
INNER JOIN "market"."customers" ON "orders"."customer_id" = "customers"."customer_id"
GROUP BY "customers"."email"
ORDER BY SUM("orders"."total") DESC
Download and start managing your MongoDB and SQL databases with ease.
Download Free Trial