Write a SQL query in the Editor, run it, and read the rows it returns. Use this page for your first run, or to see what the Editor shows while a query runs and after it ends.
The Editor item appears in the sidebar, and the page opens, only if you have the Execute Query or the Add/Remove Consoles permission. If you cannot see it, ask your administrator to check your role in Roles and permissions.
Your queries are saved in consoles, and only you can see your own consoles. To learn what a console does, see Consoles, saving and history.
SELECT * FROM <database>."<table>" LIMIT 100
To avoid typing names, point to a database, table or column in the Database Explorer and click Insert into editor.
Run the query in one of these ways:
On macOS, Cmd+Enter works like Ctrl+Enter.
Read the rows in the Results tab. Use the footer to move between pages. See The data grid for everything the grid can do.
To stop a query that runs too long, click Stop Query, the square icon in the toolbar. It is active only while a query runs.
While a run is in flight, the play button shows Running... and cannot be pressed again. If the run cannot start, the button reads Run blocked, for example until every required parameter has a value.
| You do | What runs |
|---|---|
| Click the play button with text selected | Exactly the selection |
| Click the play button with no selection | The statement at the cursor. If the cursor sits between statements, the nearest one. |
| Press Ctrl+Enter with text selected | Exactly the selection, straight away |
| Press Ctrl+Enter with no selection | The statement at the cursor is highlighted and the Statements list opens. Press Enter, or Ctrl+Enter again, to run it. |
In the Statements list, press ↑ or ↓ to cycle through the candidates; its footer reads Enter run · ↑↓ choose · Esc cancel. The list offers the statement at the cursor first, then each SELECT subquery that encloses it, from the outermost to the innermost, and then the console's other statements. Typing, clicking elsewhere or leaving the editor cancels the choice.
To run only a subquery, put the cursor inside the brackets around its SELECT, press Ctrl+Enter, press ↓ until the subquery is highlighted, and press Enter.
If your cursor sits after the last semicolon, the last statement runs rather than the whole console.
While a query runs:
You can switch to another console while a query runs, and you can leave the Editor: the run keeps going on the server. When a run ends in a console you are not viewing, a pulsing dot appears next to its name: blue for success, red for failure. If you return while a run is still going, the Editor reattaches to it; when it ends you see Query completed with "Query finished while you were away", or Query failed with the reason.
Runs are private: only the person who started a run can read its result, stop it, export it or chart it. Each run also adds a row to the console's History tab.
On success, the toast Query executed successfully reads Returned N rows in followed by the time the query took on the server. N counts the rows loaded into the first page, which holds up to 1000 rows.
When the result has more than one page, the footer shows the full total as Showing X to Y of Z rows. If the query returns no rows, the grid shows No data available with "This query returned no results". NULL values appear as an italic NULL.
When you return to a console, the Editor fetches its last result again; while that load runs, the Results tab shows Loading results with a Cancel button. With nothing to show yet, it reads No Results Yet with "Execute a query to view results here".
Moving to another page runs the query again for that page. Page sizes and the other grid settings live on The data grid.
Click Stop Query. When the stop works, the toast Query cancelled appears, and the run is not shown as a failed one. If the stop does not work, you see Failed to cancel query.
A cancelled run stays cancelled: a result that arrives late is discarded, and a cancelled run is never reported as failed.
The selected text, if you have selected any. Otherwise, the statement where the cursor is.
Ctrl+Enter opens the Statements list so you can check what will run. Press Enter, or Ctrl+Enter again, to run the highlighted statement. If you have selected text, it runs straight away instead.
Put the cursor inside the brackets around the SELECT, press Ctrl+Enter, press ↓ until the subquery is highlighted, and press Enter. You can also select the subquery and press Ctrl+Enter.
The toast counts only the rows loaded into the first page. The footer shows the full total, and you can move between pages to see the rest.
Yes. Switch to another console, or leave the Editor: the run continues on the server. A pulsing dot next to the console's name shows when its run ends.
It counts how long the running statement has been going. It disappears when the run ends; the final time then shows in the toast and in the console's History tab.
Click Copy error in the Results tab. The button appears when the database returns the error, and it reads Copied for a moment after you click it.
A console that still has a default name, such as New Console or New Console 1, gets a short name from the AI after its first successful run. If the AI does not suggest a usable name, the name stays. To rename a console yourself, double-click its name. See Consoles, saving and history.
No. The Editor shows the toast Query cancelled, and a cancelled run is never reported as failed.
The Editor loads the console's last result again from the server, showing Loading results while it works. If the result is no longer there, the Results tab shows No Results Yet. Run the query again to see the rows.