TQ
dev.com

Blog about software development

Subscribe

Should table names be singular or plural?

02 Jan 2021 - by 'Maurits van der Schee'

As we all know "naming things" is jokingly named as one of the two hard problems in software engineering (the other one being "cache invalidation"). This post is about the question whether your (database) table names should be plural or singular, e.g. "posts" or "post". You should read the following Stack Overflow post to understand that this is a heated debate:

Stack Overflow: Table Naming Dilemma: Singular vs. Plural Names

In this post I will portrait my (albeit late) take on this in the context of web application development (spoiler: you should use singular).

How it was

What changed

Why plural is better

Why singular is better

Conclusion: use singular

The world is changing, generated REST and MVC are becoming the standard and inflection functions have proven to be problematic. This makes the best practice of plural table names cumbersome. We should adjust the best practice and switch to singular for everything now. Let's do this now, it is not too late.

Enjoy programming!


PS: Liked this article? Please share it on Facebook, Twitter or LinkedIn.