Field (and other SQL Structure) Naming Conventions
I would like to know some conventions regarding nomenclature.
For example, I see fields (columns) composed of multiple words separated by underscore characters, and the words beyond the first are lowercase, like so:
But is it advisable NOT to use other conventions, like camel case, or all initial capitals on multi-word field names?
And what about the naming and use of character case for other SQL structures: database and table, especially composed of multiple words.
Another question: what is the permitted character set for all names of databases, tables, fields, etc.? Are "foreign characters" permitted such as ö, ü, ç, ş?
I don't think it matters too much what naming convention you use as long as you are consistent throughout, especially if some time down the road someone else will have to go through your code for whatever reason.
Personally, I don't use underscores in table or column names and I prefix table names with tbl and fields (table columns) with fld. For me it makes it easier to read sql queries, especially complex ones.
I do a similar thing with html element id's and names. I prefix all textbox names and id's with txt, select list names and id's with sel and so on. It helps me read my scripts easier.
Yup, Consistency. One thing you need to be careful about is using reserved words as table names. (e.g. description, show etc.).
For character set, On some database yes they are specially on localized languages but I would rather use utf all throughout
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Tags for this Thread