Possible Duplicate:
Database, Table and Column Naming Conventions?
Each time when new project starts, I’m thinking about naming conventions of table and columns in database. Which case is your recommendation and why?
Case 1. column_name
Case 2. ColumnName
Case 3. Column_Name
Case 4. columnName
So Which Should I Use: Singular or Plural? The correct answer is that there is no right or wrong when naming database tables — just be consistent from the start. The only wrong answer with database table names is to use a combination of plural and singular.
Naming conventions are a set of guideline that make strong foundations for such a consistent system. These guidelines ensure that the names of database entities are readable, easy to use in queries and do not collide with names of other defined entities or keywords.
Each Primary Key name should have a “PK_” prefix. The first letter of a table name should be capitalized. The last word of a table name should be end with the character "s" (or "es") to indicate plural. If a table name contains more than one word then the first letter of each word should be capitalized.
Column names must contain only A to Z, 0 to 9, and underscore (_) characters. Column names can contain multiple underscores. The column name must not be very generic. Avoid words such as term, multiplier, description, name, code, and so on.
You should use case #1 because it's free of case sensitivity problems. Also, camel case sucks with acronyms.
columnID
columnId
columnIDAlternative
columnIdAlternative
RASCScore
RascScore
column_id
column_id_alternative
rasc_score
Also, spaces between words are visually more pleasant than jamming everything together. Absolutely worth whatever perceived pain of typing an underscore there is. Underscores simulate spaces and compound nouns and phrases have spaces in normal, written language. TheOnlyPeopleToTypeLikeThisMayHaveBeenTheRomans.
Whatever you decide to choose, sticking to the same is most important, that is be consistent.
I prefer #2 as this is imo most readable and as mentioned before underscore is ugly and annoying to type. #4 is second best. #3 i like the least, both uppercase and underscore is overkill.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With