Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>Pretty SQL AliasNew to Visual Studio Code? Get it now.
Pretty SQL Alias

Pretty SQL Alias

LinZhang

|
4 installs
| (1) | Free
Align SQL field and table aliases vertically
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Pretty SQL Alias Aligner

  • Align AS aliases in your SQL-like scripts, including Spark SQL, T-SQL, and more.
  • Improve the readability of your queries in seconds.
  • Designed for professional data practitioners.

Before

with w_1 as (
select col_1           as f1
     , col_2  as f2
     , cast(col_3 as int) as f3
from tbl_a  as t1 
join tbl_b         as t2 
)
select * 
from w_1  as a
join other_tbl      as b

After

with w_1 as (
select col_1               as f1
     , col_2               as f2
     , cast(col_3 as int)  as f3
from tbl_a  as t1 
join tbl_b  as t2 
)
select * 
from w_1        as a
join other_tbl  as b

Features

  • Instantly formats blocks of code to vertically align the AS keyword used for field and table aliases,
  • Ignores AS keyword inside other statements (e.g., with clause CTE and CAST(... AS INT)) to prevent unnecessary formatting.
  • Activate with a simple keyboard shortcut or via the Command Palette.

Usage

  1. Open any scripts containing SQL-like syntax.
  2. Press the keyboard shortcut to format the active file:
    • Windows/Linux: Ctrl+Alt+A
    • Mac: Cmd+Alt+A

Alternatively, open the Command Palette (Ctrl+Shift+P), type Prettify SQL Aliases, and press Enter.

Changing the Shortcut

If the shortcut conflicts with another command:

  1. Go to File > Preferences > Keyboard Shortcuts.
  2. Search for Prettify SQL Aliases.
  3. Click the pencil icon to set a new keybinding.

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft