We put common prefixes on related tables to make sure they display alongside one another within our DB manager (Toad, Enterprise Manager, etc).

So for instance, all user tables begin with the term User:

  • User
  • UserEvent
  • UserPurchase

Ideally, in recognition from the a trio of benefits of the programmer these tables ought to be named User, Event, Purchase correspondingly in order to save some typing, agreed?

Is naming convention the very best (only?) practice for grouping related tables together naturally?

I am inclined to not in favor of the grain in naming conventions on two counts here...

  1. I do not like using prefixes to ensure that things group together inside a given UI. In my experience the tables ought to be named so that in code they're easily readable making sense. There has been numerous studies (mostly overlooked by developers) that demonstrate that such things as using underscores, logical names, getting rid of abbreviations, and getting rid of such things as prefixes possess a large effect on both comprehension and also the speed of dealing with code. Also, if you are using prefixes to interrupt lower tables where do you turn whenever a table can be used by multiple areas - as well as worse it begins in just one area but later begins for use in another area. Do you have to relabel the table?

  2. I almost completely ignore title measures. I am a lot more worried about readability and understandability than I'm about taking 1/tenth of the second longer to type a column or table title. Whenever you also bear in mind all the time wasted attempting to remember should you abbreviated "number" as "no", "num" or "nbr" and bear in mind using such things as Intellisense, using longer, more significant names is a smart choice in my experience.

With individuals things in your mind, in case your UserEvents table really has related to occasions associated with a person then that title makes sense. Using just Occasions would finish up providing you with a poorly named table since the title is not obvious enough for me.

Hope this can help!

I wouldn't make use of a naming convention for reasons of alphabetizing table names. It's nice if this calculates this way, but this should not be by design.

Read Joe Celko's book "SQL Programming Style." His first chapter for the reason that book is all about naming conventions, led through the ISO 11179 standard for metadata naming. Among his recommendations would be to avoid unnecessary prefixes inside your naming convention.

I'd make use of this notation i.e "UserEvent" just in case this table is really a representation of numerous-to-many relation between "User" and "Event" tables.

I suppose the naming convention in SQL is or at best should stick to the same recommendations as utilized in other programming languages. I've always preferred variable names / class title that clearly recognized the reason which results in more typing. I believe the importent factor to consider is the fact that code is just written once but read lots of occasions, so clearness is essential. The final four to five years I've observed the variable names have become from "eDS" to "employeeDataSet" and i believe that IntelliSense may be the primary reason for your. I believe we will have exactly the same take place in SQL since Red-colored Gate SQL Prompt and today MS SQL2008 have introduced Intellisense in to the mainstrem database world.

It is dependent how if/the way you intend to expand upon your computer data model. For example, let's say you made the decision that you simply not simply want to have User Occasions, but additionally, Account Occasions, or Login Occasions, and User, Accounts, and Logins are various kinds of organizations, however they share some Occasions. For the reason that situation, you'd may want a stabilized database model:

  • Customers (Id int, Title varchar)
  • Accounts (Id int, Title varchar)
  • Logins (Id int, Title varchar)
  • Occasions (Id int, Title varchar)
  • UserEvents (UserId int, EventId int)
  • AccountEvents (AccountId int, EventId int)
  • LoginEvents (LoginId int, EventId int)