AI-Powered SQL Assistant

Overview

DBWillow's AI-Powered SQL Assistant (Premium feature) helps you write SQL queries without knowing SQL syntax. Simply describe what you want in plain English, and the AI generates optimized SQL queries for you.

Getting Started

Accessing the AI Assistant

  1. Open DBWillow and connect to a database
  2. Click the "AI Assistant" button in the toolbar (or press Ctrl+Shift+A / Cmd+Shift+A)
  3. The AI Assistant panel will open

Your First Query

Try asking the AI:

  • "Show me all users"
  • "Find orders from last month"
  • "Count products by category"

The AI will generate the SQL query and execute it automatically.

How It Works

Multi-Stage Reasoning

The AI uses a sophisticated multi-stage process:

  1. Table Selection: Identifies which tables are relevant
  2. Schema Analysis: Examines table structures and relationships
  3. Query Generation: Creates optimized SQL queries
  4. Execution: Runs the query and shows results

Schema Awareness

The AI understands your database structure:

  • Table names and relationships
  • Column names and data types
  • Foreign keys and joins
  • Table descriptions (if you've added them)

Best Practices

Be Specific

Good:

  • "Show me customers from California who placed orders in the last 30 days"
  • "Calculate total revenue by product category for 2024"

Less Effective:

  • "Show customers"
  • "Revenue data"

Mention Relationships

When you need data from multiple tables:

  • "Show me orders with customer names and product details"
  • "List users and their order counts"

Specify Format

For dashboards:

  • "Show monthly sales as a line chart"
  • "Display top 10 products as a bar chart"

Advanced Features

Query Refinement

After the AI generates a query:

  1. Review the generated SQL
  2. Ask for modifications: "Add a filter for active users"
  3. The AI will update the query

Error Handling

If a query fails:

  1. The AI will analyze the error
  2. Suggest fixes automatically
  3. Regenerate the corrected query

Learning Your Database

The AI learns from your database:

  • Frequently used tables
  • Common query patterns
  • Your naming conventions

Use Cases

Data Exploration

Quickly explore your database:

  • "What tables do I have?"
  • "Show me sample data from the users table"
  • "What's the structure of the orders table?"

Reporting

Generate reports instantly:

  • "Monthly revenue by product category"
  • "User signups over time"
  • "Top performing products"

Data Analysis

Answer business questions:

  • "Which customers haven't ordered in 90 days?"
  • "What's the average order value by region?"
  • "Show me products with low inventory"

Dashboard Widget Generation

The AI can also create dashboard widgets:

  1. Describe what you want: "Show daily sales for the last 30 days as a line chart"
  2. The AI generates:
    • The SQL query
    • The dashboard widget
    • Chart configuration
  3. The widget appears on your dashboard automatically

Tips and Tricks

Use Table Descriptions

Add descriptions to your tables to help the AI:

  1. Right-click a table → "Edit Description"
  2. Add context about the table's purpose
  3. The AI uses this information for better queries

Combine with Manual Editing

  1. Let the AI generate the base query
  2. Manually refine it in the SQL editor
  3. Best of both worlds

Save Generated Queries

After the AI generates a query:

  1. Review and test it
  2. Save it to your favorites
  3. Reuse it later

Pricing & Usage Limits

AI features are available with any paid subscription tier:

  • Starter ($1/month promotional): Unlimited AI during promotional period
  • Professional ($4/month): 100 AI queries/month, 25 widget generations/month
  • Power ($8/month): Unlimited AI queries and widget generations

Limitations

  • Requires active paid subscription (Starter, Professional, or Power tier)
  • Works best with well-structured databases
  • May need refinement for very complex queries
  • Requires internet connection for AI processing

Troubleshooting

AI Not Responding

  • Check your internet connection
  • Verify Premium subscription is active
  • Try refreshing the AI panel

Incorrect Queries

  • Be more specific in your request
  • Check that table/column names are correct
  • Review and refine the generated query

Slow Responses

  • Complex queries may take longer
  • Large databases may require more processing time
  • Try breaking complex requests into smaller parts

Next Steps