Layouts

functional

Give multiple result sets the layout that makes the comparison or review easy.

A query can return several result sets at once, a script with three SELECTs, a stored procedure that returns a header and its lines - and the useful layout depends on what you are comparing. SQLly has three, and every one of them shows the same grids; only the arrangement changes.

LayoutShowsReach for it when
TabbedOne result set at a time, one tab each.One set matters, or the rows are wide. The default.
StackedEvery set as a collapsible card in one scroll.Several small sets need to stay in view together.
CanvasA grid of cells you define in the SQL itself.A dashboard-style query whose arrangement should travel with the file.

Switching layouts

  • Result layout - the control at the right of the results tab bar, beside Export. One click flips between Tabbed and Stacked; its tooltip says which you are in.
  • The query toolbar has the same Tabbed/Stacked toggle, drawn as whichever layout is active.
  • Right-click any cell or column header in a grid: Tools › Layout offers Stacked Layout, Tabbed Layout, and Canvas Layout. This is the way into Canvas, since the toggles only move between the other two.

Tabbed and Stacked are a view preference, flip between them at any time without touching the query, and SQLly remembers the choice per editor tab when session resume is on. Canvas is different in kind: the arrangement is written into the SQL as comments, so it is part of the file and reproduces for whoever opens it next. Choose Canvas for a query that has no board declared and its sets simply appear stacked.

A query can also name its layout. Put -- sqlly layout: stacked (or tabbed, or canvas) on a line of its own anywhere in the script and the run opens in that layout, for you and for whoever opens the file next; the controls still switch it afterwards. In Stacked, -- sqlly lines: 8 allots eight rows to every card and -- sqlly lines 2: 20 gives the second result set twenty, so a long detail set can sit under a short summary without a drag. -- sqlly focus: 2 keeps the second result set in front: Tabbed selects its tab and Stacked scrolls its card into view as soon as it arrives.

You rarely need to type these. Right-click a result's name — its tab, or its card header — and choose Show by Default, Set Number of Rows in Result Set (which saves the rows it shows right now), or Comment Out Result, which comments out the statement that produced it so it no longer runs. The pencil beside the name opens the same settings, plus the name, in one dialog. Each choice is a single edit to the query that undo reverses.

Naming result sets

Result sets are labelled Results 1, Results 2, and so on. A -- sqlly name comment gives one a real name, used as its tab title in Tabbed and its card header in Stacked:

-- sqlly name 1: Totals
-- sqlly name 2: By region
SELECT COUNT(*) AS orders, SUM(total) AS revenue
FROM sales.orders;

SELECT region, SUM(total) AS revenue
FROM sales.orders
GROUP BY region;

The number is the 1-based position of the result set, and the comment can sit anywhere in the query. You rarely need to type it: click the pencil beside a tab title or card name, type, and press Enter (Esc cancels). SQLly updates the existing comment or adds one at the top of your SQL, so the name comes back on every run.

What every layout shares

  • Each set keeps its own grid - with its own Grid, Pivot, and Chart tabs, sort, and filters. Pivoting the second set does not touch the first.
  • The output tabs stay put. Messages and the other output panes sit beside the results in every layout. ⌘1 shows the results and ⌘2 the messages (Ctrl on Windows and Linux).
  • Directives aim at the first set. A pivot or chart directive configures the run's first result set, whichever layout shows it.

Column widths

When a query runs, every column sizes itself to fit both its name and its widest value, growing as more rows stream in and shrinking when the values are short, so a 6-character code under the heading CustomerName still gets room for the whole heading. No column auto-sizes past 30 characters: a longer value, or a longer column name, is drawn cut off with an ellipsis (…) so you can always tell there is more. Change the limit under Settings › Results › General › Auto-size columns up to; 0 always sizes columns to their full content.

To resize a column without dragging its header edge, right-click the column header and choose Column › Widen Column or Narrow Column, right after Move Column Left and Move Column Right. Each choice changes the width by one step, so repeat it until the column fits.

A column you drag or resize from the menu keeps its new width for the rest of the run, and a remembered column layout for the same query wins over auto-sizing.

Making room

ActionmacOSWindows and Linux
Show or hide the results pane⌘JCtrlJ
Maximize results / restore the editor⌘⇧JCtrlShiftJ
Detach results to a window⌘⌥JCtrlAltJ
Detaching is separate. Detach results to window, the shortcut above, or the button at the far right of the results tab bar - opens the whole results panel in its own OS window, regardless of the current layout, so a second monitor can earn its keep. It is a desktop feature; the browser preview keeps results in the page.

Layout only decides where a result set is drawn. Sorting, filtering, formatting, pivoting, and export all behave the same in each. All of these shortcuts can be changed under Keybindings.

In this section

Tabbed
Keep the workspace calm by looking at one result set at a time.
Stacked
Keep every result in view on one scroll when the whole batch matters.
Canvas
Arrange result panes freely when the answer is easier to understand side by side.