Conventions

Following a set of database conventions improves the readability and understanding of the database and related sql. Every DBA has their own thoughts about which convention to follow. This is ours

Naming

  • Names must clearly describe the object

  • Use PascalCase for all names

  • Don’t use Hungarian notation (like intNumber)

  • Don’t use abbreviations except if they are well-known

Applies To
Convention
Example

Tables

[Noun], singular

Customer

Stored Procedures

[Verb][Noun]

UpdateCustomer

Views

[Noun]

CustomerOrders

Fields

[Noun]

Surname

SQL Queries

  • Use consistent indentation

  • Use UPPERCASE for keywords, like SELECT, FROM, WHERE, and JOIN

  • Use meaningful aliases, not single letters or abbreviations

  • Use single quotes ('string') for string literals and double quotes (“identifier”) for identifier

Poor SQL - Instant Free and Open-Source T-SQL Formatting

Last updated