SQL Formatter Options
Options
Alignment
The Alignment Options in the SQL Formatter Tool allow you to control how specific elements of your SQL statements are aligned. These settings improve the readability of your code by aligning tokens and operators consistently.
Available Options
Align Comma
- Ensures that commas in lists (e.g., in
SELECT
orINSERT
statements) are vertically aligned for better readability.
- Ensures that commas in lists (e.g., in
Align Alias
- Aligns table or column aliases (e.g.,
AS alias
) to a consistent position, making it easier to identify them.
- Aligns table or column aliases (e.g.,
Smart Alignment
- Automatically determines optimal alignment based on the structure and length of the SQL statement.
- Overrides manual alignment rules when enabled for a more intelligent and dynamic formatting style.
Align at Position
- Allows you to set a specific column position (e.g., 60) for alignment.
- Use the
-5
and+5
buttons to fine-tune the alignment position incrementally. - This option is disabled if Smart Alignment is enabled.
Align Equal Sign
- Aligns equal signs (
=
) in SQL statements, especially inWHERE
clauses or assignments, to enhance clarity.
- Aligns equal signs (
Align Operator
- Aligns other operators (e.g.,
+
,-
,*
,/
) used in expressions or conditions for consistent formatting.
- Aligns other operators (e.g.,
Align
||
- Aligns concatenation operators (
||
) when used in SQL statements, improving the visibility of concatenated strings or expressions.
- Aligns concatenation operators (
How to Use These Settings
Enable/Disable Specific Alignments
- Check or uncheck the boxes for options like Align Comma, Align Equal Sign, or Align
||
to toggle their alignment features.
- Check or uncheck the boxes for options like Align Comma, Align Equal Sign, or Align
Smart Alignment vs. Manual Alignment
- Enable Smart Alignment for automatic, dynamic alignment based on SQL structure.
- Disable Smart Alignment to manually set a specific alignment position using the Align at Position option.
Fine-Tune Alignment Position
- Use the position field and the
-5
/+5
buttons to adjust alignment positions incrementally.
- Use the position field and the
Tips for Optimal Usage
- Use Smart Alignment for general-purpose formatting, as it dynamically adapts to the SQL structure.
- Enable specific alignment options like Align Equal Sign or Align Operator when working with complex conditions or calculations to enhance clarity.
- Use Align at Position for strict alignment requirements, such as adhering to organizational or team coding standards.