SQL Editor

Overview

DBWillow's SQL Editor is built on Monaco Editor (the same editor used in VS Code) and provides a professional SQL editing experience with syntax highlighting, autocomplete, and powerful query management features.

Basic Usage

Opening the Editor

  1. Connect to a database
  2. Click the "SQL Editor" tab
  3. Start typing your SQL queries

Executing Queries

  • Press Ctrl+Enter (Windows/Linux) or Cmd+Enter (macOS)
  • Or click the "Execute" button
  • Results appear in the panel below

Multiple Tabs

  • Create multiple query tabs
  • Each tab is saved automatically
  • Switch between tabs easily
  • Close tabs when done

Features

Syntax Highlighting

SQL syntax is automatically highlighted:

  • Keywords (SELECT, FROM, WHERE, etc.)
  • Functions (COUNT, SUM, AVG, etc.)
  • Strings and numbers
  • Comments

Auto-completion

The editor provides intelligent autocomplete:

  • Table names
  • Column names
  • SQL keywords
  • Functions

Press Ctrl+Space to trigger autocomplete.

Query History

All executed queries are saved:

  1. Click the "History" button
  2. Browse past queries
  3. Click to reuse a query
  4. Search history

Saved Queries

Save frequently used queries:

  1. Write your query
  2. Click "Save Query"
  3. Give it a name and description
  4. Access from "Favorites"

Result Display Modes

Pagination Mode

  • Shows 100 rows per page
  • Navigate with page controls
  • Perfect for large result sets

Limit Mode

  • Shows first N rows
  • "Load More" button for additional rows
  • Good for exploring data

Stream Mode

  • Real-time results
  • Shows rows as they arrive
  • Best for long-running queries

Keyboard Shortcuts

  • Ctrl+Enter / Cmd+Enter: Execute query
  • Ctrl+S / Cmd+S: Save query
  • Ctrl+/ / Cmd+/: Toggle comment
  • Ctrl+F / Cmd+F: Find
  • Ctrl+H / Cmd+H: Replace
  • Alt+Up/Down: Move line
  • Ctrl+D / Cmd+D: Select next occurrence

Advanced Features

Query Timeout

Configure query timeout:

  • Default: 30 seconds
  • Increase for long-running queries
  • Set in connection settings

Multiple Result Sets

Handle queries that return multiple result sets:

  • Each result set appears in a separate tab
  • Navigate between result sets
  • Export each separately

Export Results

Export query results:

  1. Execute query
  2. Click "Export"
  3. Choose format: CSV, JSON, Excel, SQL
  4. Download file

Best Practices

Formatting

  • Use consistent indentation
  • Break long queries into multiple lines
  • Add comments for complex logic
  • Use meaningful aliases

Performance

  • Test queries on small datasets first
  • Use LIMIT for exploration
  • Add indexes for frequently queried columns
  • Optimize JOINs

Security

  • Never execute untrusted SQL
  • Be careful with DELETE/UPDATE
  • Use transactions for data modifications
  • Test on development databases first

Troubleshooting

Query Not Executing

  • Check SQL syntax
  • Verify database connection
  • Check query timeout
  • Review error messages

Slow Queries

  • Check query execution plan
  • Add indexes if needed
  • Optimize JOINs
  • Limit result sets

Autocomplete Not Working

  • Ensure database connection is active
  • Refresh schema cache
  • Check table/column names
  • Restart DBWillow if needed

Next Steps