w

Advanced Features

The SQL Prettify tool offers advanced formatting options and features for professional SQL development.

Advanced Formatting Options

Indentation Control

The tool provides precise control over SQL indentation:

  • 2 Spaces: Compact formatting suitable for simple queries
  • 4 Spaces: Standard formatting recommended for most use cases
  • 8 Spaces: Wide formatting for complex queries with many nested elements

Keyword Case Management

Control the appearance of SQL keywords:

  • UPPERCASE: Traditional SQL formatting with all keywords in uppercase
  • lowercase: Modern formatting with all keywords in lowercase
  • Preserve Case: Maintain the original case as typed

Function and Data Type Formatting

  • Uppercase Functions: Convert function names like count(), sum() to COUNT(), SUM()
  • Uppercase Data Types: Convert data types like varchar, int to VARCHAR, INT

Advanced Layout Options

  • Align Commas: Align commas in SELECT lists for better readability
  • Break Before Boolean Operator: Add line breaks before AND/OR operators for complex WHERE clauses

History Management

Automatic History Saving

The tool automatically saves your formatting history:

  • Last 50 Records: Maintains up to 50 recent formatting operations
  • Persistent Storage: History is saved locally in your browser
  • Quick Access: Click on any history record to reload the SQL and settings

History Features

  • Load from History: Click any history record to restore the SQL and formatting options
  • Delete Individual Records: Remove specific history entries
  • Clear All History: Remove all saved history records

Statistics and Analysis

Real-time Statistics

The tool provides detailed statistics about your SQL formatting:

  • Original Lines: Number of lines in the input SQL
  • Formatted Lines: Number of lines in the formatted output
  • Original Characters: Character count of the input
  • Formatted Characters: Character count of the formatted output

Formatting Analysis

Use the statistics to:

  • Optimize Query Length: See how formatting affects query size
  • Track Changes: Monitor the impact of different formatting options
  • Compare Versions: Analyze different formatting approaches

Supported SQL Constructs

Complex Queries

The tool handles advanced SQL constructs:

  • Subqueries: Nested SELECT statements with proper indentation
  • Common Table Expressions (CTEs): WITH clauses with appropriate formatting
  • Window Functions: OVER clauses with proper alignment
  • Complex JOINs: Multiple table joins with clear structure

Data Manipulation

  • INSERT Statements: Multi-row inserts with proper formatting
  • UPDATE Statements: Complex WHERE clauses with clear structure
  • DELETE Statements: Conditional deletes with proper formatting

Data Definition

  • CREATE TABLE: Table definitions with column formatting
  • ALTER TABLE: Schema modifications with clear structure
  • INDEX Creation: Index definitions with proper formatting

Best Practices

Consistent Formatting

  1. Choose a Standard: Select consistent indentation and keyword case
  2. Use History: Leverage the history feature to maintain consistency
  3. Review Output: Always review formatted output before using

Performance Considerations

  1. Large Queries: The tool handles large SQL queries efficiently
  2. Complex Formatting: Advanced options may take slightly longer for complex queries
  3. Browser Storage: History is stored locally and doesn't affect performance

Team Collaboration

  1. Standardize Settings: Agree on formatting options with your team
  2. Share Examples: Use the example feature to demonstrate formatting standards
  3. Document Preferences: Keep a record of preferred formatting settings

Troubleshooting

Common Issues

  • Formatting Errors: If formatting fails, check for SQL syntax errors
  • Large Queries: Very large queries may take longer to format
  • Browser Compatibility: Ensure you're using a modern browser

Getting Help

  • Load Example: Use the example feature to see proper formatting
  • Check History: Review previous successful formatting attempts
  • Clear and Retry: Clear the input and try again if issues persist
Was this page helpful?