Total Pageviews

Monday, February 6, 2012

Database Naming Conventions


  1. All names used throughout the database should be in lowercase.
  2. Name parts are separated by underline not by a space. As underline is an alphanumeric character, database will be platform independent. Because sometimes space is not allowed.
  3. Numbers should not use for names
  4. (.) should not be used for names as separator, because (.) is used as field name in queries. Ex: tablename.columnname
  5. Must not use reserved words
  6. Should keep the names simple. Must not use long , complex names
  7. Database name should contain projectname
  8. Prefix should be company name or owner's name
  9. Ex: cmpn_invoice


Table Names

  1. Should contain name of entity followed by 3 letter  acronym. Acronym is created with table name. Ex: manufacturer_prd
  2. Also we can use prefix for table names same as database prefix for all the tables in that specific database  Ex: cecb_manufacturer_prd
  3. Should not use prefix like tbl_
  4. Should use simple short clear names for tables. Should not use doubtful names
  5. Should use singular names
  6. Group tables with same prefix as master table Eg: user_type, user_status
  7. Field Names
  8. For the primary key columns we can use id as name. For product_prd table id_prd is the primay key field name
  9. Foreign key can be named as idctg_prd. Here this foreign key belongs to product table product_prd. And it reffers to category table category_ctg
  10. Each column name should include 3 letters acronym of table name, Ex: name_prd
  11. date_ prefix shold use for date columns and is_ prefix should use for boolean type columns. Eg: date_expire, is_confirmed



No comments:

Post a Comment