Skip to content

Commit e3ab8e6

Browse files
authored
Add alias using recommendation in joins
1 parent efdcc02 commit e3ab8e6

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

SQL Server Name Convention and T-SQL Programming Style.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,7 @@ SQL Server T-SQL Coding Conventions, Best Practices, and Programming Guidelines.
337337

338338
```
339339
- Always use aliases for table names. More details [here](https://sqlinthewild.co.za/index.php/2019/04/23/no-this-is-not-a-bug-in-t-sql/).
340+
- Whenever you’re working with multiple tables in a join (explicit or, like this one, implicit), always specify which table each column comes from. Even if your code works just fine today, just adding an unfortunately named column many years later can break your code. More details [here](https://sqlsunday.com/2020/12/21/the-uncorrelated-correlated-subquery/).
340341
- <a id="tsql-alias"> Avoid non-standard column and table aliases, use, if required, double-quotes for special characters and always `AS` keyword before alias:
341342
```sql
342343
SELECT

0 commit comments

Comments
 (0)