Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Tables Names and ID Standard

Author  Topic 

shapper
Constraint Violating Yak Guru

450 Posts

Posted - 2009-04-09 : 12:09:23
Hello,

Is there any standard for naming tables and ids?

For example, for tables:
- Posts, Tags, PostsTagsRelationship
- Post, Tag, PostTagRelationship
- Posts, Tags, PostsTags

For example, for ids:
- TagId or just Id? ...

Thank You,
Miguel

Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)

7020 Posts

Posted - 2009-04-09 : 13:53:45
There is no universal standard, but I prefer TagId instead of Id.

It makes it a lot clearer where the column comes from when you have multiple tables in a query, and it also lets you use the same column name for the primary key in the parent table and for a foreign key in a child table. Generally, it just makes life easier.

The same is also a good rule for other columns: ProductName instead of Name






CODO ERGO SUM
Go to Top of Page
   

- Advertisement -