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

Features

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

Writing queries

Basic query structure

SELECT column1, column2
FROM your_table
WHERE condition
GROUP BY column1
ORDER BY column2 DESC
LIMIT 100

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
  • Save frequently used queries

Working with results

Visualization

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

Cached results

  • Query results are cached for 24 hours
  • View cache status for each query
  • Force refresh when needed
  • Configure caching per query

Advanced features

Variables

Use variables in your queries:

SELECT *
FROM orders
WHERE date >= {{start_date}}
  AND date <= {{end_date}}

Scheduled queries

  • Set up recurring queries
  • Export results automatically
  • Monitor query performance
  • Get alerts on failures

Security

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