Auto alias suggestion
functionalKeep joins readable with table-name aliases that stay consistent from the first column to the last.
When you pick a table or view from completion after FROM or
JOIN, SQLly can write a short, readable alias with it.
The alias comes from the table's name, so you get PaymentMethod AS pm
rather than a parade of t1/t2 labels.
-- type "Pay" after FROM and accept dbo.PaymentMethod SELECT * FROM dbo.PaymentMethod AS pm


How the alias is built
The default style, Capital letters to lower case, works from the table name and ignores the schema:
| Table name | Alias | Why |
|---|---|---|
PaymentMethod | pm | Its capital letters, lower-cased. |
Sales.SalesOrderHeader | soh | Capitals from the table name only. |
[Order Details] | od | Brackets and quotes are ignored. |
sales_order_header | soh | With underscores, the first letter of each word. |
customers | cs | No capitals: the first letter plus the next consonant. |
orders | or1 | The same rule spells or, a keyword, so a 1 is added. |
Tick Include schema to put the schema's initial in front:
Shared.PaymentMethod becomes spm and
Sales.SalesOrderHeader becomes ssoh. The other style,
Auto based on join, uses just the first letter of the table name:
Customers becomes c.
Collisions and reserved words
- Already used: if the alias is taken in the statement, a number is added. A second table that would be
cbecomesc2, thenc3. Matching ignores case. - SQL keywords: whichever rule built it, an alias that would read as a keyword such as
ON,OR,AS,IN,IS,BY,OF,TO,GO,AND, orFORgets a1added.OrderNotesbecomeson1, andordersbecomesor1. If that is taken too, the usual number follows:or12. - Alias already typed: if an alias already follows the name, SQLly leaves it alone.
Settings
All of these are in Settings › Editor › IntelliSense and apply to every query tab:
| Setting | Choices | Default |
|---|---|---|
| Alias names | Capital letters to lower case (with an optional Include schema), Auto based on join, or Do not suggest | Capital letters to lower case, schema not included |
| When you accept a table or view | Add the alias automatically, or offer it as a second suggestion | Add automatically |
Include the AS keyword | Orders AS o or Orders o | On |
With Offer the alias as a second suggestion, accepting the table inserts just the name. The list then shows the alias on its own, labeled table alias for PaymentMethod. Press Enter or Tab again to add it, or keep typing to skip it. Do not suggest turns aliases off in both modes.
Once the alias exists
Column completion uses it automatically: type pm. and the list offers
PaymentMethod's columns. Aliases are worked out from the name each time,
so the same table gets the same alias in every query unless that alias is already
taken.
The joins written by auto join suggestion name their new table with a first-letter alias, whatever this setting says. They use your existing aliases for the tables already in the query.