Essential Database Naming Conventions (and Style)

by Justin Watt
comments gratefully accepted: jwatt [at] email [dot] unc [dot] edu
Last Modified: 10/15/04

style

  1. use lowercase characters
  2. separate words and prefixes with underlines, never use spaces
  3. avoid using numbers

table names

  1. choose short, unambiguous names, using no more than one or two words
  2. give tables singular names, never plural
  3. avoid abbreviated, concatenated, or acronymic names
  4. prefix lookup tables with the name of the table they relate to
  5. for a linking (or junction) table, concatenate the names of the two tables being linked
  6. rare problem

field/column names

  1. the primary key should be the table name suffixed with "_id"
  2. prefix the name of every field with the table name (excluding foreign keys)
  3. foreign key fields should have the same name as the primary key to which they refer
  4. prefix fields of type date with "date_" and type boolean with "is_"

don't like my conventions? try these: