Naming Conventions

Naming Conventions

The ACME database is using a simplified concept of the Hungarian notation in its naming conventions. The idea is to encode the information about the objects in their names. Many database developers find this concept very helpful, especially when working with huge databases which contain hundreds tables and thousands of columns.

Note 

Hungarian notation is a naming convention that allows the developer to determine the type and use of an identifier. It was invented by Dr. Charles Simonyi who has worked for Microsoft since 1981. The notation is very popular with C++ and Java developers. Dr. Simonyi says it was called "Hungarian" as a joke. The notation is supposed to make code more readable, but in fact it looks so unreadable it might as well be written in Hungarian.

The main ACME naming rules are as follows:

  1. Each table has an abbreviation used as a part of every column, index, or constraint name for the table. For example, ADDRESS table is abbreviated with ADDR. Index names are prefixed with IDX, check constraints start with CHK, and so on:

    ADDR_ID_N (column name)
    CHK_ADDR_TYPE (check constraint name)
    IDX_ADDR_CUST (index name)
    FK_ADDR_CUST (referential integrity constraint)

    The foreign key name on the last line also indicates the referential integrity direction (from ADDRESS to CUSTOMER).

  2. All columns have a postfix that symbolizes the general data type of the column (N for numeric datatypes; S for character strings, D for dates, etc.). For example:

    ADDR_ID_N
  3. The primary key columns include a suffix ID:

    ADDR_ID_N
  4. The foreign key columns include the name of the primary key of their parent table as well as suffix F. For example,

    ADDR_CUSTID_FN

    is a foreign key to CUSTOMER_ID_N in CUSTOMER table.

    Note 

    ACME naming conventions are simplified and for demonstration purposes only. For example, S stands for any character string datatype and does not distinguish between CHARACTER and VARCHAR; N stands for any numeric data type (INTEGER, DECIMAL, FLOAT), etc.