Jump to content

Naming Conventions


Kcarson

Recommended Posts

What type of naming conventions do each of you use (if any) for SQL?For databases, tables, column names, views, stored procedures, etc.At the company I work for our standards are:Databases (no true standard and the overall data model here should not be followed ever)Tables (usually starts with an Object name (usually the application that will use the table, or something such as Ordd (for Order) or Cust (for Customer).The column names have no standard naming convention really other than foreign keys are named the same as the primary key in the table they relate to.Views are prefixed with vwStored Procedures are prefixed with sp_ and then the action they perform (Get, Insert, Update, Delete, Create, Count, RPT (for Reports), Save) then a few key words to describe them.Of course there are those cases where a developer either didn't know the standards or decided to completely neglect them and for whatever reason it passed through.So what about everybody else?

Link to comment
Share on other sites

yummy - conventions - i love them . . . here are some of mine - specific to DB:Databases have no ceonvention other than to be labeled in some respect to the application to which they are designed for.Tables have a two letter prefix followed by an underscore:ac_ = accounting (i.e. ac_gl_account, ac_invoice, ac_payment)co_ = customer (i.e. co_individual, co_address)ec_ = ecommerce (i.e. ec_order, ec_order_detail, ec_shipping)whenever I have a lookup table always uses the table names seperated by an _x_ (i.e. co_individual_x_address)Columns have a three letter prefix (abbreviating the table) followed by an underscore:- co_individual- - ind_id, ind_firstname, ind_lastname, ind_date_of_birth- co_address- - add_key, add_street_one, add_street_two, add_cityall databases, table names, and columns are in single tense - no "s" on the end. The fact that it is a table/database implies that there is more than one record. What you are actually doing is defining information one at a time (just all stored together) - so you're really just looking at one thing.Record 103 is a record in the co_individual table not a record in the co_individuals table - you;re only talking about one record being stored at a time (hence singular tense). The is especially true when looking at the name of the columns - you don;t see firstnames, you see firstname.Stored Procedures again nothing to specific but again each are related to the application that they are associated with. Some three letter prefix with an underscore. "SP" is reserved by the system so we stay away from using it as a prefix.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...