mysqldatabaserestrictionmysql5

What rules apply to naming a mysql column?


In a MySQL table, naming a column, can I use

What other rules shall I follow?

( MySQL5 )


Solution

  • Yes, Yes, and Yes.

    I like underscores between field names and no uppercase, but I don't want to start a flame war.

    Another good reason to not use special characters in column names is you, or others are eventually going to have to type that over and over in your application. I'd stick to the standard english alphabet.

    Good column names:

    account_id
    user_id
    first_name
    

    Bad column name:

    Ȩ̬̩̾͛ͪ̈́̀́͘ ̶̧̨̱̹̭̯ͧ̾ͬC̷̙̲̝͖ͭ̏ͥͮ͟Oͮ͏̮̪̝͍M̲̖͊̒ͪͩͬ̚̚͜Ȇ̴̟̟͙̞ͩ͌͝
    uraniumType☢☢☢☢