MySQL naming convention
1. Library names, table names, and field names must use lowercase letters and be separated by underscores.
a) MySQL has the configuration parameter lower_case_table_names, which cannot be changed dynamically. The Linux system defaults to 0, that is, the library table names are stored according to the actual situation and are case-sensitive. If it is 1, it is stored in lowercase and is not case sensitive. If it is 2, store it as it actually is, but compare it in lowercase.
b) If uppercase and lowercase letters are mixed, multiple tables such as abc, ABC, and ABC may coexist, which may easily lead to confusion.
c) Field names are shown to be case-sensitive, but are not used in actual use. That is, you cannot create two fields with the same name but different cases.
d) For the sake of uniformity and standardization, use lowercase letters in library names, table names, and field names.
2. Library names, table names, and field names are not allowed to exceed 32 characters.
Library names, table names, and field names support up to 64 characters, but for the sake of uniformity, easy identification, and reduction of transmission volume, no more than 32 characters are allowed.
3. It is forbidden to use MySQL reserved words in library names, table names, and field names.
When attributes such as library names, table names, field names, etc. contain reserved words, the SQL statement must use backticks to quote the attribute names, which will make writing SQL statements and escaping variables in SHELL scripts awkward. very complicated.
The above is the detailed content of What are the naming conventions for MySQL?. For more information, please follow other related articles on the PHP Chinese website!