Database Naming Conventions
0. Do not use spaces in your symbol names. Ever. Spaces are for civilians. I. Tables have a ‘t’ prefix. 2. A table name represents the contents of one row in the table. The table name is not plural. For example, tEmpl is the Employee table. tEmpls is incorrect. 3. Queries have a ‘q’ prefix in Access. For example, qEmpl would be a query based on the table called tEmpl. 4. In SQL Server a query is referred to as a view: use a ‘v’ prefix. 5. Stored Procedures have an ‘sp’ prefix. SQL Server only. Access has no Stored Procedures. 6. The primary key of every table is an ‘AutoNumber’ integer field named by appending “ID” to the table name, without the ‘t’ prefix. For example, the Application table is named lApplication’ and has a primary key field called ApplicationID. 7. For each table, a candidate key will be an attribute with the same name as the table, except the ‘t’ prefix. This rule is a little flexible because not all entities have a natural key that is a single attribute. S. When possible, a foreign key has the same name as the corresponding primary key in the target table.
An Example:
vb p
•11
Limp
Snow/Iiide Field, FIttco/d & Table Events Reline:4101ms
Field Name Data Type
EmpltD EmplNumber Last Name First Name Dept ID
19 Indexes: tEmpl
AutoNumber Text Text Text
Number
Primary Key Natural Key and also a Candidate Key
Foreign Key into tDept table 7,
tt
4kIndex Name PrImaryKey DeptID EmpiNumber
Field Name EmplID DeptiD
Ascending Ascending
Sort Order
EmpiNumber Ascending
The post Database Naming Conventions appeared first on My blog.