Skip to main content
SQL Editor in Flipspace
Flipspace provides direct SQL access to Flipside’s complete data catalog. Query any table, join across schemas, and export results—all with standard SQL.

Creating Queries

There are two ways to create queries:

Save from Chat

Ask Chat a question, and when the query runs successfully, click Save Query.
Save query button in Chat

Create in SQL Editor

Write queries directly in the editor with full control.
New query in the SQL Editor
1

Navigate to Queries

Go to Queries and click New Query.
2

Enter details

Add a Query Name and optional Description to help identify the query later.
3

Write your SQL

Enter your SQL in the editor. Try this example to get started:
SELECT
  DATE_TRUNC('day', block_timestamp) AS date,
  COUNT(*) AS swap_count,
  SUM(amount_in_usd) AS volume_usd
FROM ethereum.defi.ez_dex_swaps
WHERE block_timestamp >= DATEADD(day, -7, CURRENT_DATE)
GROUP BY 1
ORDER BY 1
4

Run and save

Click Run to test your query, then Create Query to save it.

Using Variables

Variables make your queries reusable by letting you change values without editing the SQL. Add variables in the Variables panel on the right side of the editor.

Variable Syntax

SyntaxUseExample
{{variable}}For values (strings, numbers, dates)WHERE address = '{{wallet_address}}'
{{{variable}}}For identifiers (table names, columns)SELECT * FROM {{{table_name}}}

Example with Variables

SELECT
  DATE_TRUNC('day', block_timestamp) AS date,
  COUNT(*) AS tx_count,
  SUM(amount_usd) AS volume_usd
FROM ethereum.core.ez_token_transfers
WHERE from_address = '{{wallet_address}}'
  AND block_timestamp >= DATEADD(day, -{{days_back}}, CURRENT_DATE)
GROUP BY 1
ORDER BY 1
This query uses two variables:
  • wallet_address — The wallet to analyze
  • days_back — Number of days to look back
When you run the query, you’ll be prompted to enter values for each variable.

Writing Queries

Table References

Use the full table path: {network}.{schema}.{table}
-- Ethereum DEX swaps
SELECT * FROM ethereum.defi.ez_dex_swaps LIMIT 10

-- Solana NFT sales
SELECT * FROM solana.nft.ez_nft_sales LIMIT 10

-- Cross-chain address labels
SELECT * FROM crosschain.core.address_labels WHERE address = '0x...'
Start with ez_* (curated) tables for most analyses:
NetworkCommon Tables
Ethereumethereum.defi.ez_dex_swaps, ethereum.core.ez_token_transfers
Solanasolana.defi.ez_dex_swaps, solana.nft.ez_nft_sales
Arbitrumarbitrum.defi.ez_dex_swaps, arbitrum.core.ez_native_transfers

Query Optimization

Always include date filters to limit scan size:
WHERE block_timestamp >= '2024-01-01'
  AND block_timestamp < '2024-04-01'
Select only needed columns instead of SELECT *:
SELECT block_timestamp, origin_from_address, amount_usd
FROM ethereum.defi.ez_dex_swaps
Add LIMIT during exploration:
SELECT * FROM ethereum.defi.ez_dex_swaps
WHERE platform = 'uniswap-v3'
LIMIT 1000
For high-level metrics, use pre-aggregated tables:
-- Faster than aggregating fact tables
SELECT * FROM solana.stats.ez_core_metrics_hourly

Example Queries

DEX Volume by Protocol

SELECT
  platform,
  DATE_TRUNC('day', block_timestamp) AS date,
  COUNT(*) AS swap_count,
  SUM(amount_in_usd) AS volume_usd
FROM ethereum.defi.ez_dex_swaps
WHERE block_timestamp >= DATEADD(day, -30, CURRENT_DATE)
GROUP BY 1, 2
ORDER BY 2 DESC, 4 DESC

Top Token Holders

SELECT
  user_address,
  SUM(amount) AS total_balance
FROM ethereum.core.ez_token_transfers
WHERE contract_address = '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48' -- USDC
  AND block_timestamp >= DATEADD(day, -90, CURRENT_DATE)
GROUP BY 1
ORDER BY 2 DESC
LIMIT 100

Cross-Chain Bridge Activity

SELECT
  destination_chain,
  DATE_TRUNC('day', block_timestamp) AS date,
  COUNT(DISTINCT sender) AS unique_bridgers,
  SUM(amount_usd) AS volume_usd
FROM ethereum.defi.ez_bridge_activity
WHERE block_timestamp >= '2024-01-01'
GROUP BY 1, 2
ORDER BY 2, 4 DESC

Next Steps