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

# Run a basic query

> Learn how to write and execute SQL queries across all blockchains in the Allium App.

Write SQL queries spanning **all blockchains offered by Allium**. Query raw blockchain data for full flexibility, or leverage abstracted data models to quickly access the data you need (e.g., `crosschain.dex.trades` and `crosschain.stablecoin.transfers`).

<Steps>
  <Step title="Create a New Query">
    Navigate to [app.allium.so/analyze/queries](https://app.allium.so/analyze/queries) and click **New**.
  </Step>

  <Step title="Write Your SQL Query">
    Enter your SQL query in the editor. Here's an example that fetches DEX USD volume for Ethereum, Base, and Solana over the last 10 days:

    ```sql theme={null}
    -- DEX USD volume for Ethereum, Base, and Solana for the last 10 days
    select
      date(block_timestamp) as date,
      chain,
      sum(usd_amount) as usd_volume
    from crosschain.dex.trades
    where
      block_timestamp >= current_timestamp - interval '10 days'
      and chain in ('ethereum', 'base', 'solana')
    group by all
    order by date asc;
    ```
  </Step>

  <Step title="Execute and View Results">
    Click **Run** to execute the query. Results appear in table format:

    <Frame>
      <img src="https://mintcdn.com/allium-e770e2b7/ZJULWDhWUB9qEr_O/images/run-query-result-table.png?fit=max&auto=format&n=ZJULWDhWUB9qEr_O&q=85&s=b2d32a5b2035bd53d7a5d3b09ed31921" alt="Query results table" width="1836" height="1136" data-path="images/run-query-result-table.png" />
    </Frame>

    Switch to chart view and group by chain to visualize the data:

    <Frame>
      <img src="https://mintcdn.com/allium-e770e2b7/ZJULWDhWUB9qEr_O/images/run-query-result-chart.png?fit=max&auto=format&n=ZJULWDhWUB9qEr_O&q=85&s=bc40e2ba42330acb45c3f20c2e493efc" alt="Query results chart" width="1836" height="1174" data-path="images/run-query-result-chart.png" />
    </Frame>

    <Info>
      Learn more about charting options in the [Visualize Results](/app/visualisations) guide.
    </Info>
  </Step>
</Steps>

## Next Steps

<CardGroup cols={2}>
  <Card title="Parameterized Queries" href="/app/run-queries/parameterized-query">
    Create reusable queries with configurable parameters
  </Card>

  <Card title="Query Previous Results" href="/app/run-queries/query-on-previous-result">
    Build on top of completed query runs
  </Card>

  <Card title="Explorer API" href="/api/explorer/overview">
    Execute queries programmatically via REST endpoints
  </Card>

  <Card title="Visualize Results" href="/app/visualisations">
    Create charts and visualizations from query results
  </Card>
</CardGroup>
