Singular or plural database table names?

SqlMysqlSql Server

Sql Problem Overview


Exact Duplicate

> Table Naming Dilemma: Singular vs. Plural Names

Is it better to use singular or plural database table names ? Is there an accepted standard ?

I've heard arguments for and against it, what do you guys think ?

Sql Solutions


Solution 1 - Sql

Singular, so you can have:

  • Customer
  • CustomerAddress
  • CustomerAddressAuditTrail

etc.

Solution 2 - Sql

IMHO, Table names should be plural like Customers.

Class names should be singular like Customer if it maps to a row in Customers table.

Solution 3 - Sql

I like singular names but appear to be in the minority.

Solution 4 - Sql

My personal philosophy is that using a plural database table name is redundant, unless you're only planning for the table to contain one row.

Solution 5 - Sql

I like to use singular names like Agent that have PK names like AgentID.

But that's just me :o)

Solution 6 - Sql

I like to use plural forms, simply because one table contains several entities, so it seems more natural to me.

Linq to SQL converts plural form table names to singular when creating data entities. I assume that Microsoft would not have implemented this functionality if they considered plural forms for table names bad practice.

Solution 7 - Sql

At my current company we use Plural for table names. The reasoning is this: If we have a Customers table we consider each row a Customer, so the table itself is a collection of customers.

Solution 8 - Sql

Well, obviously your database table names have absolutely got to be named in a "standard" fashion which I will hitherto arbitrarily define.

First, all tables names shall be prefixed with "t_". Following this, the singular entity name in StudlyCaps, e.g. "Customer". Immediately afterwards, this shall contain the number of columns created in the first version of the schema, for historical purposes, followed by an underscore, and the precise normal form of the data; either "1", "2", "3" or "B" for BCNF. Any higher normal forms shall be denoted by a "P".

Some examples of acceptable names are:

t_Customer_6_3
t_Order_5_B
t_OrderLine_4_2

I think my point is, it really doesn't matter, as long as the name is reasonably descriptive and naming is consistent.

Solution 9 - Sql

The most important thing is to be consistent in your usage. It is annoying to have to remember which tables are plurals and which are not. Same thing with your field names, pick one stadard and use it. Don't make the poor developers have to determine if this table uses person_id or personid or peopleid or person$id, etc. It is amazing the amount of time you can waste when you don't have standards trying just to remember which table uses what.

Solution 10 - Sql

There is no should or must be this way or that way correct answer to this question. It's up to the designer of the database and software.

As for me, I usually use singular names becouse when I do the E-R diagram I have an entity Customer , not Customers, so I keep it same as to not get confused.

Ofcourse some frameworks do favor one style or another, so you should be best of to follow those practices when you notice them.

Solution 11 - Sql

There are many arguments for each, but it all boils down to what you feel comfortable with. Neither is wrong.

What's really important is that you are consistent. Choose one standard and stick to it, which one you choose is of less importance.

Solution 12 - Sql

IMHO it doesn't really matter, just do whatever is comfortable with you and the people that are using the database.

I think I subconsciously list main data tables with an s and "pick list" or foreign key tables and singular.

Solution 13 - Sql

As with lots of these types of questions the best answer is often "consistent". You can argue the table represents a single entity and as such deserves a singular name, or that it contains multiple instances of an entity so it should be plural. My advice is flip a coin and go with it for the entire database (or stick with the convention that already has a majority).

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
Questionlalala2007View Question on Stackoverflow
Solution 1 - SqlTim RobinsonView Answer on Stackoverflow
Solution 2 - SqlGulzar NazimView Answer on Stackoverflow
Solution 3 - SqlMarkRView Answer on Stackoverflow
Solution 4 - SqlMattKView Answer on Stackoverflow
Solution 5 - SqlwcmView Answer on Stackoverflow
Solution 6 - SqlAdrian GrigoreView Answer on Stackoverflow
Solution 7 - SqlAlexander KahounView Answer on Stackoverflow
Solution 8 - SqlRobView Answer on Stackoverflow
Solution 9 - SqlHLGEMView Answer on Stackoverflow
Solution 10 - SqlAzderView Answer on Stackoverflow
Solution 11 - SqlGuffaView Answer on Stackoverflow
Solution 12 - SqlDForck42View Answer on Stackoverflow
Solution 13 - SqlSTWView Answer on Stackoverflow