Data · SQL

SQL Query

Run a SQL SELECT/WITH/VALUES query against your loaded tables (DuckDB, or the stdlib sqlite3 module as an offline fallback) and save the result as a new table.

In the menus Data › Tools › SQL Console…

Also searched as sql query select from database query

When to use it

Join, filter, aggregate, or reshape two or more loaded tables with SQL instead of point-and-click steps, especially multi-table joins, grouped aggregation, or window functions a spreadsheet-style tool makes tedious. Every loaded table is queryable by name; the query result becomes its own new table you can analyze further.

When not to: The task is a single, common cleanup step (pivot, melt, filter, dedupe, a simple join) already covered by the point-and-click Wrangling & Import Recipe panel, or you need to write to an external file or database (the console is read-only over loaded tables and cannot reach the filesystem or network at all, by locked design).

Step by step

  1. Open it from the menu

    Click Data in the menu bar; under Tools choose SQL Console….

  2. Fill in the form

    Fill in Query, Tables to query, Name for the result table (optional).

  3. Check the options

    The options start at their defaults: Preview rows. Change one only when your question needs it.

  4. Run the analysis

    Press Run analysis. The Result Card opens on its Results tab.

What to choose in the form

Fields of the SQL Query form
Query Sql requiredA value you type or choose on the form. The SQL SELECT/WITH/VALUES query text.
Tables to query Source Tables requiredA value you type or choose on the form. The loaded tables visible to the query, as a list of {alias, table_id, file_name} entries.
Name for the result table New Table Name optionalA value you type or choose on the form. Display name for the resulting table.
Preview rowsHow many result rows to show in the Results tab. Default: 50.

How to read the card

The Results tab starts with what to know first (rows left out, checks that did not pass), then the interpretation in words and the Key Results; charts and assumption checks follow further down. Learn More explains the method in plain words. Read a Result Card covers all four tabs.

A worked example

Joining a loaded orders table to a loaded customers table on customer_id, filtering to orders over $100, and computing total spend per region.

Result: A new table with one row per region, ordered by total spend descending, saved as its own queryable table in the project.

The join and aggregation that would require several separate wrangling steps in a point-and-click panel are expressed in one readable query, and the resulting table can now be charted or fed into a hypothesis test exactly like any table loaded directly from a file.

From the Statistics Library.

The code tabs

Code gives this analysis as Python, R and MATLAB code (and SAS where the tab offers it), reading the data the way KernelStats did. Export sends the card to a report or to slides. See The Code tab.

Understand the statistics

Ask Oobi

Type one of these into Ask Oobi beside your data:

  • Join orders to customers on customer_id and show total spend per region, highest first.
  • Explain the SQL query console in plain words.
  • What does missing data mean?

Last reviewed November 16, 2026.

Report an unclear step