Naming Tables

Use Singular Names

Let’s take a table that stores invoices.  A lot of people would name that table “Invoices”.

Simple enough, but what about related tables?

A table that contains invoice line items may be called “InvoiceItems”.  Let’s add a third called “InvoiceItemDetails”.

What you end up with now, is the following order:

InvoiceItemDetails
InvoiceItems
Invoices

Now your tables are in alphabetical order, but completely out of logical order.  Invoices is the parent table, so it should come first, followed by InvoiceItems, and InvoiceItemDetails.

This is why I like using the singular:

Invoice
InvoiceItem
InvoiceItemDetail

Simply removing the “s” puts everything in logical order, the way they should be.

It’s a simple thing, but it makes it easier to find what you’re looking for.

About the Author Phillip Theriault

I am a computer programmer specializing in building database software with ASP.NET MVC, C#, and SQL Server.

follow me on:

Leave a Comment: