The building blocks of life and also your notebooks.

What are cells?

Cells are how you query data in Count. Every cell is a SQL select statement, and returns a table.

Types of cells

Depending on how you want to build your query, you can choose one of the following cell types:

  • SQL - type SQL directly into the cell, using the syntax for your database.

  • Drag/drop - build queries by dragging table and column names from the data pane into the cell.

Cell types

You can switch from a drag/drop cell to a SQL cell, but not vice versa.

Naming cells

When you create a cell it will be given a letter as a default name. You can rename the cell to help remind yourself, and others, what each cell represents.

What can you query?

You can build a query using any of the tables/columns you see in the data bar on the left hand side of the notebook. This includes:

You can search for tables and cells in the Data bar, visible on the left of draft notebooks. Here you can:

  • View all of the tables available to this notebook

  • Search for tables and columns

  • View previews of columns

  • View all of the cells in the notebook

  • Drag columns into drag/drop cells

The features of the data bar

Cell inputs

SQL input

When you create a SQL cell you can type SQL directly into the cell and it will return a table of results. You should write your SQL query using the specific dialect of the database you've connected to. The query must only return a single table.

Drag/drop input

To use drag/drop input, drag columns into the cell to generate a query. Drag columns into the 'select' field to request data from those columns, and into the 'where' field to filter the results.

Drag columns into a drag/drop cell to create a query

You can switch the cell to SQL to see the SQL generated using the "Show SQL" option in the cell menu:

View the generated SQL

If you edit the generated SQL, you won't be able to go back to a drag/drop cell.

Cell outputs

Once your query has been executed successfully, you can choose whether to display the results as a table (the default) or as a visual by clicking on 'Show visual' / 'Show table' button.

Cell output options

Resize results: You can change the size of the output by clicking on it and dragging the control handles.

Results summary: This is a summary of the results returned from your database. For performance reasons Count only displays the top 10,000 rows of the query results in the notebook UI. However, any query which references the cell will use the full results table in subsequent analyses.

Show visual/table: When the 'Show visual' option is first selected, Count will attempt to automatically plot the data for you.

Expand: Expanding the output cell lets you explore the results full screen. If the cell is in visual mode, expand takes you to the visual editor where you can customise the visual.

Download csv: Downloads the results table as a csv. The maximum table size is 1m rows. For larger tables, you can apply a LIMIT to the query to download the results in chunks.

Check out the Visualisation guide to learn how to create and customize visuals.

Referencing other cells

One of the most powerful features of the Count notebook is the ability to reuse cells as tables that can be referenced in other cells.

This helps you build up complex analyses step-by-step, and re-use interim results throughout your analysis.

To reference another cell, just use the cell name as if it were a table in your database. There's no special syntax to learn - just write the cell name as you would for any other table name (e.g. escape special characters).

Use the 'Cells' part of the data bar to quickly see what cells and results are available.

Viewing notebook structure

As you begin to construct more complex logic, you may find it useful to see how your notebook cells are related - this is what the 'Structure' tab is for:

Viewing the 'Structure' tab

Cells are represented here by their names - in this case a, b, c - and are linked with a line if they depend on one another. In this case we see:

  • a depends on nothing, so there is no line entering into the left of a

  • b depends on a, so there is a line from the right of a into the left of b

  • c depends on b, so there is a line from the right of b into the left of c

If any cell has an error, all of the cells that depend on it will error too, and this will show up in the 'Structure' tab.

If a cell is selected, that cell and any cells that depend directly on it or it depends on are highlighted.

Cell referencing also applies in the same way to Interactive controls, which are a specialised type of cell. See the Interactive controls page to learn more.

Hiding Cells

By default, when you publish a notebook all cell inputs will be hidden but the outputs will remain.

If you want to hide an entire cell (input and output) you can

  • Select the option from the cell option menu

  • Use the keyboard shortcut when the cell is selected

  • Click the 'Hide cell' action button when the cell is selected

Hiding cells

Deleting Cells

To remove a cell from your notebook completely, use the cell menu to the left of the cell, or press the delete key when the cell is selected.

Deleting cells

If you want to restore a cell you just deleted, use Ctrl/Cmd + Z to undo.