> ## Documentation Index
> Fetch the complete documentation index at: https://docs.dataville.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Query with SQL

> Run read-only SQL across exportable sources, in Data Studio or over the API.

Every exportable source is also a table you can query with SQL, including joins across sources and against your own connected sheets. See [Connected data](/connected-data). You can run queries in Data Studio in the dashboard or send them to the API, and both use the same engine. That engine is DuckDB, so DuckDB's SQL dialect and functions apply.

Queries are billed per row returned, so use `LIMIT`. See [Plans and credits](/plans-and-credits).

## Querying in Data Studio

You can write and run a query in [Data Studio](https://app.dataville.com/data-studio) without writing any code. Switch between **Single Source** and **Cross Source**, pick the sources you want, and start from one of the example queries or write your own. **Run Query** runs the statement and Data Studio lists the rows it returns.

<Frame>
  <img src="https://mintcdn.com/dataville/zDlwOKSC3fbhiIB6/images/data-studio-sql.png?fit=max&auto=format&n=zDlwOKSC3fbhiIB6&q=85&s=299a36ef0e17ce8b33142284558fcc74" alt="The SQL Query Playground in Data Studio: a Single Source and Cross Source toggle, source chips, a SQL editor, and a Run Query button." width="2576" height="1588" data-path="images/data-studio-sql.png" />
</Frame>

## Querying from the API

Send a single `SELECT` statement. Table names are the source names, and you can join a connected sheet in by passing its id and referencing it by its alias.

<CardGroup cols={2}>
  <Card title="Run a SQL SELECT across the datasets" icon="table" href="/api-reference/export-and-sql/run-a-sql-select-across-the-datasets">
    The endpoint, request body, and example responses.
  </Card>

  <Card title="Run SQL against one connected sheet" icon="table" href="/api-reference/connected-sheets/run-sql-against-one-connected-sheet">
    Query a single sheet on its own, without the public sources.
  </Card>
</CardGroup>

## Limits

Data Studio and the API apply the same limits.

| Limit | Value | When exceeded |
| - | - | - |
| Statements | `SELECT` only | 400 |
| Rows per query | 1,000 | `LIMIT` is reduced to 1,000 |
| Query length | 10,000 characters | 400 |
| Execution time | 30 seconds | 408 |
| Queries | 1,000 per day per account | 429 |

The hosted engine queries Dataville's tables and your connected sheets. It cannot read files or URLs. To query your own files alongside Dataville's data, or to work with more than 1,000 rows at a time, run DuckDB on your own machine and read Dataville's Parquet over HTTP. See [Reading Parquet without downloading](/export-datasets#reading-parquet-without-downloading).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.