# SQL cells
source: https://docs.chalk.ai/docs/notebook-sql

## Query Chalk features, configured datasources, and notebook DataFrames with SQL.

Use SQL cells to query Chalk features, tables in a configured Integration,
or DataFrames in the notebook session. Give the result a variable name so later SQL,
Python, and Markdown cells can use it.

### SQL example

This Chalk SQL cell selects orders from the fictional orders feature namespace and binds its
DataFrame result to orders.

Use the two selectors above the query to choose a resource group and SQL dialect:

- Resource group: choose the compute resources that execute
a Chalk SQL query. The example selects default; other resource groups run queries on
their independently configured resources.
- SQL dialect: choose Chalk SQL to query Chalk features, as this example does with the
orders namespace. Select a configured datasource, such as Analytics, to query its tables
using that datasource's SQL dialect, or DataFrames to query DataFrame variables in the
notebook session.

Use the selectors, expand or collapse the source and output, or select Run to replay the
sample result. This example does not connect to a warehouse.

### Result variables and tables

A SQL cell binds its output to a result variable. Rename the variable to describe the data it
holds; downstream cells refer to it by that name. The notebook's variable explorer lists the
session's variables with a preview of each value.

Results render as browsable tables. You can page through rows, aggregate columns, and download
the result from the cell's output.

### Querying DataFrames

Select DataFrames as the query target to query a DataFrame produced by an earlier cell.
This lets you split a longer query into stages or query data prepared in Python. Chalk infers
the dependency from the variables the cell reads, so its producers can run first under the
notebook's run modes.





