The Natural Language Naming Convention
This naming convention recognizes four different types of 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
People_Addresses
Organization_Phones
Shipments_containing_Items
Lookup or attribute table names should be in the singular form and clearly describe the attribute.
Organization_Type
Martial_Status
Quality_Descriptor
Collection 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.
People_Notes
Field names should always be in the singular. Use names that are meaningful to your customers.
The name of each 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
Debit_Amount
Shipment_Number
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_Alpha
Shipment_UPDATE_to_Transfers
SQL may well be the most ubiquitous computer language. It is designed for manipulating databases. If you work with databases, you are almost certainly using SQL even if you can't see it. It is a standard that almost everyone supports but almost no one feels restricted to. Extensions to SQL come in a zillion flavors, but the core is rock steady. Ten year old SQL code can be used with today's databases.
Although SQL has its shortcomings and hence its detractors, it survives and even thrives because it meets a well-defined set of basic needs (SELECT, INSERT, UPDATE, etc.) in a relatively simple, straight-forward manner. An SQL program consists of only two things: Objects (Tables, Recordsets, etc.) and actions taken on those objects (SQL Keywords).
The common and herein recommended practice is to use the all caps format for SQL keywords, and to let the environment determine the format of the rest of the statement. In our environment, SQL statements might look like this:
SELECT DISTINCTROW Person_ID, Last_Name, First_Name, Middle_Name
FROM People ORDER BY Last_Name, First_Name;"
Use all caps format for keywords as shown above. Take care to name constants carefully to prevent confusion with SQL keywords; the formats are the same.
SELECT DISTINCTROW Person_ID, Last_Name, First_Name, Middle_Name
FROM People ORDER BY Last_Name, First_Name;"