Skip to content

Commit

Permalink
Update 2-how-we-style-our-sql.md
Browse files Browse the repository at this point in the history
Group by column names
  • Loading branch information
Vhonani-Nelwamondo authored Dec 9, 2024
1 parent 0cb8e68 commit 6899619
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ id: 2-how-we-style-our-sql

- 🔙 Fields should be stated before aggregates and window functions.
- 🤏🏻 Aggregations should be executed as early as possible (on the smallest data set possible) before joining to another table to improve performance.
- 🔢 Ordering and grouping by a number (eg. group by 1, 2) is preferred over listing the column names (see [this classic rant](https://www.getdbt.com/blog/write-better-sql-a-defense-of-group-by-1) for why). Note that if you are grouping by more than a few columns, it may be worth revisiting your model design.
- 🔢 Ordering and grouping by column names and not Group by 1,2,3 this works on adhoc sql queries and not SQL queries you use in production.

## Joins

Expand Down

0 comments on commit 6899619

Please sign in to comment.