Skip to content

Querying with SQL and Expressions

Aziz Nadirov edited this page Nov 17, 2026 · 1 revision

Querying with SQL and Expressions

The editor above the table has two modes, switched with SQL / Expression on the right.

SQL

Write any DuckDB SQL query and press Execute Query or Ctrl+Enter. The table is called by its tab name.

An SQL query and its result

SELECT region, product, COUNT(*) AS orders,
    ROUND(SUM(qty * unit_price), 2) AS revenue
FROM orders
WHERE NOT returned
GROUP BY region, product
ORDER BY revenue DESC
  • The editor completes keywords, table names and column names as you type, and highlights the syntax.
  • Errors are shown before anything changes; the table stays as it was.
  • Other open tabs are available by their names, so you can join them: SELECT * FROM orders JOIN customers USING (customer).
  • Quote names with spaces or capitals in double quotes: "Unit Price".

Expressions

Expression mode is a small language for adding and changing columns without writing a whole query:

orders[revenue] = orders[qty] * orders[unit_price]
orders[size] = IF(orders[qty] >= 5, 'bulk', 'single')
orders[month] = MONTH(orders[order_date])
  • table[column] = … adds the column, or replaces it if it exists.
  • Text functions (UPPER, TRIM, SPLIT_PART, REGEX_EXTRACT…), dates (YEAR, QUARTER, DATE_TRUNC, STRFTIME…), maths (ROUND, MOD, LN…) and conditions (IF, IFNULL, COALESCE) are built in. The editor completes them and shows their description.
  • DROP_DUPLICATES(orders[customer]), DROP_NULL(orders[qty]) and REPLACE(…) work on the whole table.
  • Below the editor, a live preview shows the SQL the expression turns into.

Help → Expression Language Guide in ParVu, and the expression language reference, list every function. The same language is used for Formulas, with [column] as a shorthand for this table's columns.

Applied Steps, Undo and Reset

Every query, menu operation and cell edit becomes a step in the Applied Steps list. Each step works on the result of the one before.

Applied Steps after a filter and a group by

  • Undo (Ctrl+Z) reverts the last step.
  • Reset Query goes back to the original file in one go.
  • A step only changes what you see; the file on disk changes when you Save (see Saving and Exporting).

While any transform is applied, cells can't be edited. The status bar says Read-only, and undoing or resetting the transforms makes the cells editable again.

Clone this wiki locally