Welcome to MSDN Blogs Sign in | Join | Help

Database table naming conventions

I was recently adding some tables to a database, and was presented with the silly problem of naming a table "User" or "Users."  To me the table name should represent the entity, but on the flip side the table is holding a collection of those entities.

 Since I'm open to suggestion, what are your thoughts on table naming?

Published Thursday, July 31, 2008 5:51 PM by sferg

Comments

# a-foton » Database table naming conventions

Thursday, July 31, 2008 9:00 PM by a-foton » Database table naming conventions

# re: Database table naming conventions

Brain storming these sort of conventions is a good idea for all of us.

For the example you presented I'd suggest things that will spark a memory later.

If that table has user names, why not name it UserNames? Maybe UserRegions, UserAccounts, etc.

 Salute,

   Mark Wisecarver

Thursday, July 31, 2008 9:17 PM by wisemx

# re: Database table naming conventions

Personally I use the entity name, such as User from your example, although I've seen the plural used also.

In many respects it doesn't matter which you use as long as you are consistent throughout the entire database schema design.

I took a look at AdventureWorks a moment ago and they too used the entity name without the plural.

Team Foundation Server also uses this standard too.

With that then I would say that AdventureWorks and TFS are good example to follow.

Regards,

Doug Holland

Intel Corporation

Thursday, July 31, 2008 9:23 PM by pobjects

# re: Database table naming conventions

I have always gone with the singular in the Database to match the Entity Name.  Then when I create collections of an Entity I use the Plural.  If the Table name is singular and you use a DAL Code Generation tool it makes it easy to map 1 to 1.  However, with a plural table name and you generate that layer the Base Single Entity now looks like a collection.

Just some thoughts,

Wade Beasley

Flextronics International Ltd.

Thursday, July 31, 2008 10:00 PM by wadebeasley

# re: Database table naming conventions

I prefer to go with Users for table name and User for entity name in code.

Thursday, August 07, 2008 11:40 PM by AtulGupta
Anonymous comments are disabled
 
Page view tracker