jump to navigation

AMIN’Z Database Naming Convention v.0254 April 21, 2008

Posted by aminz in Uncategorized.
Tags: ,
trackback

Recently, I started building a database for  my latest project, and as I started naming the fields I realized that I’ve never really tried my own naming conventions for tables, columns, views, stored procs, indexes, or relationships. The main goal of adopting a naming convention for database objects is so that you and others can easily identify the type and purpose of all objects contained in the database.There are millions of people making applications that use some sort of database or another, and there are several dozens of conventions which we can use to make a more well-formed database schematic. Here i put some idea and wanna share with you.May be its very simple or with some drawback but your comment make my convention more flawless  

 

  • Use a letter as the first character of the name.
  • Avoid abbreviations
  • Avoid acronyms
  • Avoid using spaces in names even if the system allows it

 

TABLES

Table names are plural.I use t as a prefix of table name,like t_pationt_operations.Here i dont use Capital letter for first character of each word.

COLUMNS

Use field name as singular.

 

  • tpo_ID_pk
  • tpo_cabin_name
  • tpo_doctor_name

 

Here tpo stands for t_pationt_operations .i use all capital letter in ‘ID’ and i suggest to use pk,fk,un to indicate primary key,foreign key,unique key.

VIEWS

same as table name but use vw as prefix instead of t

Comments»

1. Shafiul hasan Md. tareq - June 30, 2008

I think this is not a good idea to name a table with prefix t_. I think you should use

tbl_(3 digit of module name)_TableRealName.
Example : tbl_Acc_CustomerInfo

and for column name i use
(2digit of table prefix )ColumnName
Example
CIFirstName

this naming convention is easy to maintain and understand by the developesr team.

2. aminz - July 16, 2008

thanx,shafiul hasan
For column name you use
(2digit of table prefix )ColumnName
Example
CIFirstName
But if i put an underscore between this,isnt so smart and similar to previous use like CI_FirstName.

again thanks t you

3. Sanat - July 16, 2008

every coder has their own view of naming, there are some conventions in popular scriptls similar to the one described here. Try installing the wordpress script from wordpress.org and then check your database for naming conventions … ;-)

i’m surprised to see.. you are coding for a long time and you didnot use any naming convention (nomenclature) earlier?