Skip to content

Vereinbarungen des DFG Projekts

Beatrycze edited this page Jan 9, 2017 · 2 revisions

SQL-Schema-Namenskonventionen

Allgemein

  • ensure the name is unique and does not exist as a reserved keyword (often problem with word group!) → http://dev.mysql.com/doc/refman/5.7/en/keywords.html
  • names must begin with a letter and may not end with an underscore
  • only use letters, numbers and underscores in names
  • avoid the use of multiple consecutive underscores
  • avoid abbreviations and if you have to use them make sure they are commonly understood

Tabelle

  • singular, start from capital letter e.g. User
  • avoid long names, but in case they are necessary don't use underscores (exception many to many relation) e.g. HomeAddress
  • many to many relations with x e.g. Group_x_User
  • no prefixes e.g. tbl, Table or any other

Reihe

  • singular, start from small letter, camel case e.g. postalCode
  • primary key always id
  • foreign key table_id e.g. user_id
  • no column with the same name as its table

Schlüssel

  • foreign key FK_table_field e.g. FK_User_address_id

Beispiel

Example

Clone this wiki locally