How to name the database?

When creating an object in the database, the administrator should also name it. Now let's talk about some naming techniques. First, case control of table names In general, table names or column names in the Oracle database are case-insensitive. When creating a table or column, even if the administrator uses lowercase names, the database will convert them to uppercase before saving them in the data dictionary, and then save them in the data dictionary. That's why we use lowercase names of mothers and children, but the next time we look at the names of watches, they become uppercase. Although database objects such as tables and columns in Oracle database are case-insensitive, database administrators can do so if they really need to make the database system case-sensitive. Usually, if a name is enclosed in double quotation marks, it will become a case-sensitive name in the Oracle data dictionary. However, I would like to remind the database administrator that although it is technically feasible to force the database system to adopt case, in practical work, most database administrators, including, may not recommend it. Because if there is mixed case, you need to be very careful when referring to these table names or column names. Because even if users or database administrators have the ability to never forget, it is difficult to remember the size of these names accurately when writing songs. If the database administrator insists on doing this, he is probably asking for trouble. It is a headache to strictly distinguish cases from cases when asking or doing other homework. Therefore, I suggest that database administrators use this case control carefully. Don't use this double quotation mark to control case unless there is a good reason. This double quotation mark can not only be used to control case, but also has the special function of quoting some special characters. For example, when creating a form, you need to set a famous brand number field. Some database administrators are used to using names like num#. This will not violate the naming rules of the database. But it will be more troublesome to handle. For example, when you create a table with the create statement, you need to put double quotes around this field name. Otherwise, when the statement is executed, the database will refuse to execute the statement and prompt the user with an error message. Similar special symbols also include a dollar symbol. When they build tables, they need to use double quotation marks in their statements. However, after the fields are established, you don't need to use double quotes when referring to these objects. Similarly, although Oracle database supports these special symbols, the author does not encourage database administrators to use these special symbols when naming tables or columns. This may bring unnecessary trouble to subsequent references. Second, remember that namespaces are different from other databases in Oracle database, and there is a concept called namespaces. Its name cannot be duplicate in the same namespace. If tables and views share the same namespace, it is required that not only the names of tables but also the names of tables and views cannot be the same. Because they are in the same namespace. Similarly, tables and functions are in the same tablespace, so they cannot have the same name. However, tables and indexes, tables and constraints belong to different namespaces. That is, the name of the table can be the same as the name of the constraint. Therefore, database administrators must know which objects * * * share the same namespace when naming objects such as tables. If objects in the same namespace are different (such as views and tables), they still cannot have the same name. In order to avoid the phenomenon of duplicate names in the same namespace, the author had better add the inherent prefix of the object according to the different objects when naming. For example, most database administrators usually don't prefix table objects in table names. However, when defining a function or view object, a prefix is added. For example, a function may be prefixed with FN, and a view may be prefixed with vi. In this case, there is no need to worry about renaming objects in the same namespace. However, in any case, database administrators must remember the concept of namespaces. Even in practical work, this trap can be easily avoided by prefix, but this namespace is also a necessary knowledge point in the Oracle database administrator certification exam. Therefore, we must have a clear understanding of this namespace administrator, no matter from the actual work or the needs of the certification examination. Third, establish close relationships among tables, indexes, constraints and columns. When you create a table, you can add indexes, constraints, and so on to some columns in the table. For example, in the employee information table, the employee number uniqueness constraint is set. When you create a constraint, you also need to name it. Although constraints do not belong to the same namespace as tables and columns, there are basically no restrictions when naming them. However, for the convenience of subsequent use, the author has a small suggestion on the naming of constraints. Simply put, it is a good practice to give other objects directly related to the table the name of the table. For example, there is a user table named ad_user (there is generally no object name in front of the table name, but the module prefix can be added according to the module design of the application software). There is a field named vlaue in this table, which is used to store the employee number. When designing a table, you need to add an index to this field. Then the name of this index can be named IDX _ User _ Value (that is, index prefix+table name+field name). What are the advantages of doing so? First, it can ensure that the names of related objects are not duplicated. Because the name of the table will not be repeated, if the name of the table and the name of the column are combined to form an object name, the probability of repetition can be said to be basically zero. Second, it is convenient for administrators to read, understand and maintain. As long as you see the name of an index or constraint object, you can see that it is an index or that a constraint is used in that field of which table. And you can know whether this constraint is unique or check constraint; Primary key index or foreign key index when indexing. Give the database administrator a clear feeling. This provides convenience for subsequent maintenance, upgrade, adjustment and reference. Although database objects such as tables and columns in Oracle database are case-insensitive, database administrators can do so if they really need to make the database system case-sensitive. Usually, if a name is enclosed in double quotation marks, it will become a case-sensitive name in the Oracle data dictionary. However, I would like to remind the database administrator that although it is technically feasible to force the database system to adopt case, in practical work, most database administrators, including, may not recommend it. Because if there is mixed case, you need to be very careful when referring to these table names or column names. Because even if users or database administrators have the ability to never forget, it is difficult to remember the size of these names accurately when writing songs. If the database administrator insists on doing this, he is probably asking for trouble. It is a headache to strictly distinguish cases from cases when asking or doing other homework. Therefore, I suggest that database administrators use this case control carefully. Don't use this double quotation mark to control case unless there is a good reason.