This is a summary of the coding and naming conventions that we use when designing databases.
- Keywords should all be in CAPITALS, while table names and field names should all be lowercase.
- SELECT statements should be written to utilise VIEWS, instead of using base tables. This provides a level of encapsulation.
- Stored procedures should be used instead of directly inserting into base tables. This also provides a level of encapsulation.
Script Naming Conventions
Scripts should start with
cr_ for create scripts.
Table Naming Conventions
- Underscores should be used instead of spaces.
- Table names should be plural. e.g. invoice_lines, users, items
View Naming Conventions
- Views should end with
_v. e.g. users_v, invoices_v