Results 1 to 3 of 3

Thread: Field (and other SQL Structure) Naming Conventions

  1. #1
    Join Date
    Jun 2009

    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.

    Is there a useful set of rules, especially when mixing SQL with other languages (PHP, JavaScript, C/C++, and so on)?

    Another question: what is the permitted character set for all names of databases, tables, fields, etc.? Are "foreign characters" permitted such as , , , ş?

  2. #2
    Join Date
    Mar 2010
    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.

  3. #3
    Join Date
    Oct 2009
    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

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center

Recent Articles