Bangalore MySQL User Group Meet Up
October 11, 2009
MySQL Naming Conventions
Sudheer Satyanarayana
http://techchorus.n...
   
Why?
●Readability
●Maintainability
●Reduced development costs
   
First Things First
●Avoid Reserved words
●Look up the Manual
●Write a policy
●One size doesn't fit all
   
Case Sensitivity
• All lower case: user_type
• All upper case: USER_TYPE
• Camel case: userType
• Mixed case: UserType...
   
Databases
●To prefix or not? mydb or myprefix_mydb
●You may not have an option
●You may not want to disclose the datab...
   
Tables
●To prefix or not? Mytable vs myprefix_mytable
●Avoid generic prefixes like tbl_user
●Case sensitivity matters
...
   
Columns
●Suffixing _id to indexed key – user_id vs uid vs id
●Beware of reserved words – timestamp, when
●Self explana...
   
Benefits
● More readable
● Maintainable
● Avoid deployment problems
● Reduced development costs
   
Tip
See what established projects are doing
   
Thank you
Upcoming SlideShare
Loading in …5
×

Mysql Naming Conventions Bangalore Mysql User Group Oct 11 09

2,868 views
2,793 views

Published on

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

Things to consider.

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
2,868
On SlideShare
0
From Embeds
0
Number of Embeds
13
Actions
Shares
0
Downloads
19
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

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 http://techchorus.net http://binaryvibes.co.in
  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

×