- ⚠ SQL errors here. Values are single quoted, and BETWEEN bounds are inclusive, so
```
WHEN tenure BETWEEN 1 and 3 THEN "associate"
WHEN tenure BETWEEN 3 and 5 THEN "senior"
```
won't do what you expect.
- regarding formating, I suggest open source tools to enforce it.
- regarding CTE, they can come with performance issues, so be sure to understand the tradeoff.
- If your code looks like :
```
WHEN tenure < 1 THEN "analyst"
WHEN tenure BETWEEN 1 and 3 THEN "associate"
WHEN tenure BETWEEN 3 and 5 THEN "senior"
WHEN tenure > 5 THEN "vp"
```
you should have a table associating the range and position. That scales nicely and helps documenting.
- Last, commenting code is a good idea, but these comments do not show up on the server. So good practice to use SQL comments to embed your comments in the DB.