Skip to main content
While Basedash excels at creating charts through natural language, you can also write custom SQL queries when you need more control or complex analysis.

The SQL editor

The SQL editor with a revenue by channel query using date and channel variables, the schema browser listing the warehouse tables, and the resulting stacked bar chart below

Features

  • Syntax highlighting
  • Auto-completion
  • Schema browser
  • Query history
  • Result previews
  • Performance metrics

Writing queries

Basic query structure

AI query assistant

Need help writing SQL? Our AI can:
  • Generate queries from natural language
  • Explain complex queries
  • Suggest optimizations
  • Fix syntax errors
Just describe what you want to query, and the AI will help write the SQL.

Query best practices

Performance

  • Use appropriate LIMIT clauses
  • Avoid SELECT *
  • Index important columns
  • Use efficient joins

Organization

  • Format queries for readability
  • Add comments for complex logic
  • Use CTEs for better structure

Working with results

Visualization

  • Convert results to charts
  • Export to CSV/Excel
  • Share query results
  • Save as dashboard components

Result freshness

Results refresh when you rerun a query or change inputs. Basedash may temporarily cache some results in your browser to improve performance.

Advanced features

Variables

Use variables in your queries:

Security

  • Read-only access by default
  • Query history logging
  • Resource usage limits
  • Data access controls

FAQ

No. The SQL editor runs a single SELECT statement at a time. On Postgres, Redshift, and Supabase, people with Can edit access to a data source can ask chat to make a change, and it only runs after they approve it. See Accuracy and trust.
The data source’s own dialect, such as PostgreSQL, BigQuery, or Snowflake SQL. Basedash runs your query on the data source as written.
Not in one query. A multi-source chart runs a separate query on each data source and then joins the results.
Queries return up to 10,000 rows, so aggregate in SQL instead of pulling raw rows into a chart. On Postgres, queries time out after about two minutes. Admins can change the timeout for each data source in connection settings.
Yes. Every chart keeps a query history. Open the chart’s menu, choose Query history, pick a version, and click Revert to query. Each version shows who saved it and whether the AI wrote it.