Version 1.1, April 2001 Copyright © D-Bross
When a project tries to adhere to common standards a few good things happen:
Now the bad:
Are standards necessary for success? Of course not. But they help, and we need all the help we can get! Be honest, most arguments against a particular standard come from the ego. Few decisions in a reasonable standard really can be said to be technically deficient, just matters of taste. So be flexible, control the ego a bit, and remember any project is fundamentally a team effort.
The use of the word "shall" or "must" in this document requires that any project using this document must comply with the stated standard.
The use of the word "may" or "should" designates optional requirements.
This naming convention recognizes four different types of tables. All tables names should be in uppercase, separated with underscore where is necessary.
Some restrictions for naming tables:
Primary Tables and their instances should be named with simple plural nouns. People and Employees are names typical of a primary table and instance.
The names of Linking tables will contain first the name of the primary table followed by the names of the linking table. Verbs may be used to clarify the nature of the link, and the table names may be changed to singular form for readability
PeopleAddressesLookup or attribute table names should be in the singular form and clearly describe the attribute.
OrganizationTypeCollection tables are a denormalized form. That is, the structure of a one collection table might differ by only one field from the structure of another table.
PeopleNotes
Field names should always be in the singular. All names should be in mixed case, first letter on each word should be in uppercase. Use names that are meaningful to your customers.
Some restrictions for naming fields:
The name of each primary key field shall be named ID and shall be auto-incremental field.
The name of each foreign key field shall be the singular form of the table name followed by _ID.
Employee_ID
Person_ID
Account_Type_ID
The name of each attribute field shall be the name that the customer uses to refer to the attribute.
Last_Name
The name of each query shall begin with the source of the recordset followed by the name of the SQL Keyword that dictates the action taken when the query is executed. The remainder of the name should indicate the contents of the chosen recordset and the sort order if any.
Organizations_SELECT_AlphaAn SQL statement consists of only two things: Objects (Tables, Recordsets, etc.) and actions taken on those objects (SQL Keywords).
All logical parts of a SQL statement must open new line in the statement. An exception of this rule might be if the statement is short enough to fit in 80 symbols. SQL statements must look like this:
SELECT DISTINCT Person_ID, Last_Name, First_Name, Middle_Name FROM People
ORDER BY Last_Name, First_Name
SELECT * FROM People
WHERE Person_ID = 10 AND
First_Name = "John" OR
Last_Name = "Smith"
ORDER BY Last_Name
INSERT INTO People (Person_ID, Last_Name, First_Name, Middle_Name)
VALUES (15, "Smith", "John", "Junior")
UPDATE People
SET First_Name = "John",
Last_Name = "Smith"
WHERE Person_ID = 10
The name of each SQL Keyword shall be in uppercase.
SELECT
Fields for data and time shall be in CHAR(8) or CHAR(14) format
Date fileds are CHAR(8) : YYYYMMDD