Do underscores in table names affect performance or cause issues on some platforms?
For example, user_profiles
Would it be better to use userProfiles
or is it just a matter of personal preference?
You cannot give underscore in table name. If you still want to create a new table with underscore, surround it using backticks, not single quotes.
Rule 1d (Special Characters) - For table names, underscores should not be used. The underscore character has a place in other object names but, not for tables. Using PascalCase for your table name allows for the upper-case letter to denote the first letter of a new word or name.
The rules for naming database objects (such as tables, columns, views, and database procedures) are as follows: Names can contain only alphanumeric characters and must begin with an alphabetic character or an underscore (_). Database names must begin with an alphabetic character, and cannot begin with an underscore.
By default, MySQL encloses column names and table names in quotation marks. Table names can use any character that is allowed in a file name except for a period or a forward slash. Table names must be 32 characters or less because SAS does not truncate a longer name.
Nope. Underscores are perfectly legal in table names.
This page here in the MySQL documentation tells you about what characters are allowed.
Basically:
Permitted characters in unquoted identifiers:
ASCII: [0-9,a-z,A-Z$_]
Extended: U+0080 .. U+FFFFPermitted characters in quoted identifiers:
ASCII: U+0001 .. U+007F
Extended: U+0080 .. U+FFFF
Personally I tend to stick with lowercase a-z, the occasional number, and underscores. But as @Vince said, it's just personal preference.
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