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
- Connect to a database
- Click the "SQL Editor" tab
- Start typing your SQL queries
Executing Queries
- Press
Ctrl+Enter(Windows/Linux) orCmd+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:
- Click the "History" button
- Browse past queries
- Click to reuse a query
- Search history
Saved Queries
Save frequently used queries:
- Write your query
- Click "Save Query"
- Give it a name and description
- 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 queryCtrl+S/Cmd+S: Save queryCtrl+//Cmd+/: Toggle commentCtrl+F/Cmd+F: FindCtrl+H/Cmd+H: ReplaceAlt+Up/Down: Move lineCtrl+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:
- Execute query
- Click "Export"
- Choose format: CSV, JSON, Excel, SQL
- 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
- Learn about AI Assistant
- Read Schema Explorer guide
- Try Writing Queries tutorial
