This page is the reference behind the suggestion list: when it opens, what it offers in each part of a query, how it orders the items and where it stops. To use suggestions while you write, start with Write and check SQL.
db. lists the tables of that database, and table., alias. or cte. lists the columns of that source. A dot never shows the AI suggestion; the list there is for names only.| Where the cursor is | What the list offers |
|---|---|
After FROM or JOIN, with nothing typed | Database names |
| After a database name and a dot | That database's tables |
| After a table, alias or CTE name and a dot | That source's columns |
| In the select list | Columns, functions and snippets, plus the * and full-column-list items |
In a condition, such as WHERE, PREWHERE, HAVING or ON | Columns, functions and tables, and NOT |
After { | Your parameter names |
After {name: | ClickHouse type names |
After SETTINGS, or a comma inside it | Setting names |
After a setting and = | That setting's values |
If you type an opening quote and then accept an item, the quote you typed is used, not doubled, so the inserted name is quoted once.
sel, lifts that snippet above every group (see the snippet table below).SELECT * or alias. *, the first item is Expand column list, which replaces the asterisk with the columns of the tables in the query. For how the rewrite behaves, see Write and check SQL.Type a trigger and pick the snippet from the list; it expands into the SQL shown.
| Trigger | What it inserts |
|---|---|
sel | SELECT * and a new line with FROM |
selw | A SELECT . skeleton |
selg | A SELECT with count() and a GROUP BY |
ij | An INNER JOIN with an ON condition |
lj | A LEFT JOIN with an ON condition |
cnt | count(), the number of rows |
cntd | uniq(., the number of distinct values |
with | A whole CTE: WITH . |
,cte | Another CTE, appended to an existing WITH clause |
rn | row_number() OVER (PARTITION BY . |
rnk | rank() OVER (PARTITION BY . |
bet | BETWEEN . |
in | An IN (. list of values to match |
case | A CASE WHEN . block |
The list also includes seld for SELECT DISTINCT, selo for SELECT ., and sub for an inline subquery.
| Item | What it inserts |
|---|---|
| Database | Its name and a dot, and the list moves on to that database's tables. |
| Table | The table name in double quotes, such as "orders". Its card lists the table's columns and marks the NOT NULL and PRIMARY KEY columns. |
| Column | The column name in double quotes, or alias. when a source is in play. |
* items | *, or the whole column list of a table as quoted names separated by commas. These items appear in the select list only; they are not offered in WHERE, GROUP BY, ORDER BY, HAVING, QUALIFY or PREWHERE. |
| Constraint join | A ready-made join condition, labelled constraint join: with the table's database and name, built from the relationships known for your tables. |
| CTE or alias | The name. A CTE is offered only after its definition and only in the same or a deeper part of the query; when a CTE and an alias share a name, the CTE wins. |
| Function | The call with its argument list ready to fill in. The item shows the function's category next to its name, and its card carries a description, a Returns: line and an Example:. |
| Setting | The setting's name and =, and the list moves on to its values. The card shows the setting's type and default, and a Tier: marker when the setting is not in Production; such settings are listed after production ones. A boolean setting offers 1 and 0. |
| Parameter | The full {name:Type} placeholder. See Query parameters. |
When one clause is complete, the list offers the keywords that can follow, so you do not have to remember the clause order.
| Position | Keywords offered |
|---|---|
| At the start of a statement | SELECT, WITH |
After SELECT * | EXCEPT, FROM, WHERE, PREWHERE, GROUP BY, HAVING, ORDER BY, LIMIT, SETTINGS, FORMAT, AS |
After a complete condition in WHERE | AND, OR, GROUP BY, HAVING, QUALIFY, ORDER BY, LIMIT BY, LIMIT, SETTINGS, FORMAT, WINDOW, UNION ALL, UNION DISTINCT |
| After a column in a condition | The comparison operators, such as =, !=, < and >, and word operators such as IN, LIKE, IS NULL and BETWEEN, with their negative forms |
After GROUP BY | ALL, CUBE, ROLLUP, GROUPING SETS, and aggregate functions among the names |
After a table in FROM | The join keywords, from plain JOIN to the GLOBAL, ANY, ALL, SEMI, ANTI and ASOF variants, and also AS, FINAL and SAMPLE |
After GROUP, ORDER or PARTITION alone | BY |
After ARRAY alone | JOIN |
After FORMAT | The output formats, such as CSV, JSONEachRow and Parquet |
PII_) copy of a database, its items are listed after the readable ones, so masked values are not reached by accident. See SQL dialect and data scope.The list stops for queries longer than 50,000 characters. Shorten the query, or split the work into a few queries, to get suggestions back.
sel show a snippet above the columns?From the second character of a snippet trigger, that snippet is lifted above every group, so you can reach it without typing the whole word. Accept it with Enter or Tab.
Table and column names are inserted in double quotes, so names with spaces or reserved words stay valid. A column is inserted as alias. when the editor knows which source it belongs to. If you typed the opening quote yourself, it is used, not doubled.
* item in WHERE or GROUP BY?The * and whole-column-list items are offered in the select list only, because a wildcard is not valid in those clauses. Everywhere else, pick the columns you need.
The masked (PII_) copy mirrors the names of its readable twin, so it is ranked below it; reading masked values is meant to be a deliberate choice. See SQL dialect and data scope.
A CTE becomes available after its definition is complete, and only in that part of the query and its subqueries. If a CTE and an alias share a name, the CTE is used.
Some smaller SQL boxes, such as those in popups, use a keyword-only editor. They offer keywords and snippets, with no tables or columns. Write the query in the Editor when you want the full list.
The function and setting lists are loaded from your database, and the copy behind them is refreshed about once an hour. Reopen the Editor to reload the list; a very new function can take a short while to appear.
Only the statement at the cursor is read, and a semicolon ends a statement. Move the cursor back into the statement you are writing.
When a statement does not parse yet, the editor still reads the tables from the FROM part of your text, so the tables you named stay in the list while you finish the query.