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

Naming convention for boolean columns

vanillajonathan opened this issue · comments

How should boolean columns be named?

Should they have any prefix or suffix such as "has", "can", "is" or should that be avoided?

Example "admin" could be "is_admin".

I wouldn't include the prefix here. The column type is clear that there are only two possible values - true and false - so I would call the column admin or enabled or whatever.

Okay, but date columns have the "date" suffix which could be argued that isn't needed since it should be clear what values are possible because of the column type.

Agreed. That is there for compatibility with the book from memory.