Remi C
Mar 3, 2021

- ⚠ 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.

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

Remi C
Remi C

Written by Remi C

Data architecture, data engineering, data science. Avid wood worker, DIY, and hiker

Responses (1)

Write a response