Autocomplete reference

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.

When the list appears

What appears in each part of a query

Where the cursor isWhat the list offers
After FROM or JOIN, with nothing typedDatabase names
After a database name and a dotThat database's tables
After a table, alias or CTE name and a dotThat source's columns
In the select listColumns, functions and snippets, plus the * and full-column-list items
In a condition, such as WHERE, PREWHERE, HAVING or ONColumns, functions and tables, and NOT
After {Your parameter names
After {name:ClickHouse type names
After SETTINGS, or a comma inside itSetting 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.

How the list is ordered

The snippet triggers

Type a trigger and pick the snippet from the list; it expands into the SQL shown.

TriggerWhat it inserts
selSELECT * and a new line with FROM
selwA SELECT ... FROM ... WHERE skeleton
selgA SELECT with count() and a GROUP BY
ijAn INNER JOIN with an ON condition
ljA LEFT JOIN with an ON condition
cntcount(), the number of rows
cntduniq(...), the number of distinct values
withA whole CTE: WITH ... AS (...) SELECT * FROM ...
,cteAnother CTE, appended to an existing WITH clause
rnrow_number() OVER (PARTITION BY ... ORDER BY ...)
rnkrank() OVER (PARTITION BY ... ORDER BY ...)
betBETWEEN ... AND ...
inAn IN (...) list of values to match
caseA CASE WHEN ... THEN ... ELSE ... END block

The list also includes seld for SELECT DISTINCT, selo for SELECT ... ORDER BY, and sub for an inline subquery.

What each kind of item inserts

ItemWhat it inserts
DatabaseIts name and a dot, and the list moves on to that database's tables.
TableThe table name in double quotes, such as "orders". Its card lists the table's columns and marks the NOT NULL and PRIMARY KEY columns.
ColumnThe column name in double quotes, or alias."column" 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 joinA ready-made join condition, labelled constraint join: with the table's database and name, built from the relationships known for your tables.
CTE or aliasThe 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.
FunctionThe 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:.
SettingThe 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.
ParameterThe full {name:Type} placeholder. See Query parameters.

Clause keywords the list offers

When one clause is complete, the list offers the keywords that can follow, so you do not have to remember the clause order.

PositionKeywords offered
At the start of a statementSELECT, WITH
After SELECT *EXCEPT, FROM, WHERE, PREWHERE, GROUP BY, HAVING, ORDER BY, LIMIT, SETTINGS, FORMAT, AS
After a complete condition in WHEREAND, OR, GROUP BY, HAVING, QUALIFY, ORDER BY, LIMIT BY, LIMIT, SETTINGS, FORMAT, WINDOW, UNION ALL, UNION DISTINCT
After a column in a conditionThe comparison operators, such as =, !=, < and >, and word operators such as IN, LIKE, IS NULL and BETWEEN, with their negative forms
After GROUP BYALL, CUBE, ROLLUP, GROUPING SETS, and aggregate functions among the names
After a table in FROMThe 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 aloneBY
After ARRAY aloneJOIN
After FORMATThe output formats, such as CSV, JSONEachRow and Parquet

Where suggestions stop

Questions, answered

Why did suggestions stop in a very long query?

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.

Why does typing 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.

Why did accepting a name insert double quotes?

Table and column names are inserted in double quotes, so names with spaces or reserved words stay valid. A column is inserted as alias."column" when the editor knows which source it belongs to. If you typed the opening quote yourself, it is used, not doubled.

Why is there no * 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.

Why does a masked copy of a database sit lower in the list?

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.

Why can't I see my CTE before I define it?

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.

Why do some popups offer only keywords?

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.

Why is a function I just added missing from the 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.

Why don't I get suggestions from the statement above?

Only the statement at the cursor is read, and a semicolon ends a statement. Move the cursor back into the statement you are writing.

My query is half-written. Why do I still get table suggestions?

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.