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
 Naming Lookup Tables

Author  Topic 

token
Posting Yak Master

133 Posts

Posted - 2012-10-28 : 14:31:21
I have a database called 'Lookup' where I keep all my lookup tables that are used to make sense of the data held in other tables in other databases.

Because my 'Lookup' database contains all lookup tables, I have to organise them by what type of data they hold. For example a few tables may be to do with Products, and some are to do with Education, while others are to do with Users.

So far I am putting an abbreviation in front of the table names so I know what they hold e.g. prodSKU, eduAccreditation, userGenders.

Does anyone agree with my way of doing this or have I got it fundamentally wrong somewhere? It feels like I am not following best practice so if anyone could please suggest how they would tackle it I'b be very thankful!

jimf
Master Smack Fu Yak Hacker

2875 Posts

Posted - 2012-10-28 : 18:33:27
This is a subject of great debate. What do I name my tables? Personally, I just like to name them for what they are, e.g, SKUs,Accreditation, Genders (do you really need a table for this?). If that doesn't seem enough to name that table decisively, I will then go to putting a table into a schema. For example, we have tables with states -- our state number and abbreviation for them -- which works for any line of business, but each line of business may have different needs for that basic table, like which lines of business are active for that state, which companies are licensed in that state, etc. Here, a table called ActiveStates may get complicated if it has to apply to all lines of business. But a table with a schema, like WorkComp.ActiveStates, CommAuto.ActiveStates or WorkComp.LicensedCompanies, etc. always makes sense. And you can maintain them easily.

Jim


Everyday I learn something that somebody else already knew
Go to Top of Page

sunitabeck
Master Smack Fu Yak Hacker

5155 Posts

Posted - 2012-10-28 : 20:33:01
To add to what Jim already said which I concur with, one of the things I try to do, at least of late, is to use a consistent naming convention. For the most part, as long as you are consistent, it does not matter.

There are ISO standards on naming conventions etc. which some people are fond of, but I found them to be too dense and too rigid. A related thread, which may or may not be useful for you: http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=158521
Go to Top of Page

token
Posting Yak Master

133 Posts

Posted - 2012-10-29 : 06:31:59
Thank you very much jimf, I really like the idea of using a schema to logically group together tables in one database. I guess thats the whole point of the introduction of schemas which I never knew about. I read this article http://blog.sqlauthority.com/2009/09/07/sql-server-importance-of-database-schemas-in-sql-server/ and am convincned this is the right way for me.

Thanks again and thanks sunitabeck for the information
Go to Top of Page
   

- Advertisement -