Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Mysql Naming Conventions Bangalore Mysql User Group Oct 11 09


Published on

Sudheer Satyanarayana presented MySQL Naming Conventions at the Bangalore MySQL User Group on October 11, 2009.

Things to consider.

Published in: Technology
  • Be the first to comment

Mysql Naming Conventions Bangalore Mysql User Group Oct 11 09

  1. 1.     Bangalore MySQL User Group Meet Up October 11, 2009 MySQL Naming Conventions Sudheer Satyanarayana
  2. 2.     Why? ●Readability ●Maintainability ●Reduced development costs
  3. 3.     First Things First ●Avoid Reserved words ●Look up the Manual ●Write a policy ●One size doesn't fit all
  4. 4.     Case Sensitivity • All lower case: user_type • All upper case: USER_TYPE • Camel case: userType • Mixed case: UserType Be consistent Avoid inconsistent usage like user_type, productType
  5. 5.     Databases ●To prefix or not? mydb or myprefix_mydb ●You may not have an option ●You may not want to disclose the database name
  6. 6.     Tables ●To prefix or not? Mytable vs myprefix_mytable ●Avoid generic prefixes like tbl_user ●Case sensitivity matters ●Plural or singular? user vs users ●Acronyms vs descriptive names ●Avoid too long or two short names ● myprefix_user_preferences_type vs ● user_pref_type
  7. 7.     Columns ●Suffixing _id to indexed key – user_id vs uid vs id ●Beware of reserved words – timestamp, when ●Self explanatory foreign key name ● Table contact: contact_id, PK user_id  REFERENCES user_id of user
  8. 8.     Benefits ● More readable ● Maintainable ● Avoid deployment problems ● Reduced development costs
  9. 9.     Tip See what established projects are doing
  10. 10.     Thank you