treffynnon / sqlstyle.guide

A consistent code style guide for SQL to ensure legible and maintainable projects

Home Page:https://www.sqlstyle.guide

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CHECK pens_in_drawer violates "preferred formalisms" re. BETWEEN

Gumnos opened this issue · comments

The "Preferred Formalisms" section advises

Make use of BETWEEN where possible instead of combining multiple statements with AND.

but the example in the "Defining Constraints" section has

CHECK(pens_in_drawer >= 1 AND pens_in_drawer < 100)

which should likely be

CHECK(pens_in_drawer BETWEEN 1 AND 99)

(though I'd also posit that it might make sense not to have any pens in the drawer and thus it should be BETWEEN 0 and 99)

I've updated the examples across the languages. Also, if you don't have a pen in your drawer then you cease to be a member of staff!