Subject: PSA: Natural cure for Epidemic Available

From: Ken <[email-masked]>
Date: Fri, 16 May 2014 09:45:22 -0700

Hey Ipp-archive,

I wanted to tell you how eating this one food helped me
Lower My Blood Pressure from 155/90 to 110/75

View what food here -> http://www.usseedsaw.com/nationwide/bloodpressure/psa.index

Since eating this food, heres what happened to me: 

1. I have lost 91 lbs
2. At 66 years old, I feel as healthy and energetic as I did in my 30's.
3. My extreme fatigue and dramatic mood swings have disappeared.
4. The only exercise I did was the occasional walk with my wife

This information saved my life.

-Dennis Burge

Name your primary keys using "[singularOfTableName]ID" format. That is, whether your table name is Customer or Customers, the primary key should be CustomerID.
change message stat-Urgent Info Services write - 3205 Lake Sarah-Independence, MN 55359
or http://www.usseedsaw.com/94j/gjvo4.gno4
Further, foreign keys must be named consistently in different tables. It should be legal to beat up someone who does not do this. I would submit that while defined foreign key constraints are often important, consistent foreign key naming is always important
You database must have internal conventions. Even though in later sections you'll see me being very flexible, within a database naming must be very consistent . Whether your table for customers is called Customers or Customer is less important than that you do it the same way throughout the same database. And you can flip a coin to determine how to use underscores, but then you must keep using them the same way. If you don't do this, you are a bad person who should have low self-esteem.
(2) What you should probably do.
"Fields representing the same kind of data on different tables should be named the same. Don't have Zip on one table and ZipCode on another." Yes yes a million times yes. Can you tell our database was not designed that way? A personid might be refered to in any of a dozen different ways, very annoying to maintain. I've always kept to this rule in any database I had control over designing and it makes life much simpler.   HLGEM Mar 26 '10 at 14:09
13	  	
I think the primary key should just be "ID". Such a simple convention makes the primary key predictable and quickly identifiable. I would, however, prepend the table name ("PersonID") when its used as a foreign key in other tables. This convention could help distinguish between a primary key and foreign keys in the same table.   Triynko Apr 1 '10 at 21:00
14	  	
@Tryinko Using ID all over the place is LIVING HELL for anyone doing joins of multiple tables. There's no possible way that the slight advantage of knowing this is the PK outweighs the incredible annoyance of re-aliasing the dang ID column in every bloody query over and over again. If you want a way to denote PK in a table, make it the first column. Also, denoting FKs in the names of columns is in my mind another solidly evil anti-pattern.   ErikE Jun 20 '11 at 20:03
1	  	
@Triynko if you use just "ID", it also become programatically impossible to determine the table it belongs to. With the table name prefix, you can simply cut off the last two digits of a primary key and know the table name it belongs to via code. A lot of times IT and DBA people don't realize that there are coding advantages for programmers in designing databases in certain way
Fields representing the same kind of data on different tables should be named the same. Don't have Zip on one table and ZipCode on another.
To separate words in your table or column names, use PascalCasing. Using camelCasing would not be intrinsically problematic, but that's not the convention and it would look funny. I'll address underscores in a moment. (You may not use ALLCAPS as in the olden dayskay in DB2 20 years ago, but not now.)
Don't artifically shorten or abbreviate words. It is better for a name to be long and clear than short and confusing. Ultra-short names is a holdover from darker, more savage times. Cus_AddRef. What on earth is that? Custodial Addressee Reference? Customer Additional Refund? Custom Address Referral?
(3) What you should consider.

I really think you should have plural names for tables; some think singular. Read the arguments elsewhere. Column names should be singular however. Even if you use plural table names, tables that represent combinations of other tables might be in the singular. For example, if you have a Promotions and an Items table, a table representing an item being a part of a promotion could be Promotions_Items, but it could also legitimately be Promotion_Items I think (reflecting the one-to-many relationship).
Use underscores consistently and for a particular purpose. Just general tables names should be clear enough with PascalCasing; you don't need underscores to separate words. Save underscores either (a) to indicate an associative table or (b) for prefixing, which I'll address in the next bullet.
Prefixing is neither good or bad. It usually is not best. In your first db or two, I would not suggest using prefixes for general thematic grouping of tables. Tables end up not fitting your categories easily, and it can actually make it harder to find tables. With experience, you can plan and apply a prefixing scheme that does more good than harm. I worked in a db once where data tables began with tbl, config tables with ctbl, views with vew, proc's sp, and udf's fn, and a few others; it was meticulously, consistently applied so it worked out okay. The only time you NEED prefixes is when you have really separate solutions that for some reason reside in the same db; prefixing them can be very helpful in grouping the tables. Prefixing is also okay for special situations, like for temporary tables that you want to stand out.