Naming convention for unique constraint

前端 未结 3 1335
悲哀的现实
悲哀的现实 2021-01-29 18:03

Naming conventions are important, and primary key and foreign key have commonly used and obvious conventions (PK_Table and FK_Table_ReferencedTable, re

3条回答
  •  时光说笑
    2021-01-29 18:30

    My naming convention for indices and constraints:

    • Primary key. _PK
    • Unique index/constraint. _AK{xx}
    • Non-Unique index. _IX{xx}
    • Check constraint. _CK{xx}
    • Default constraint. _DF{xx}
    • Foreign key constraint. _FK{xx}

    Where {xx} is a 2-digit sequence number, starting at 01 for each constraint type per table. Primary key doesn't get a sequence number since there can be only one. The 2-char alpha suffix meanings are:

    • PK: Primary Key
    • AK: Alternate Key
    • FK: Foreign Key
    • IX: IndeX
    • CK: ChecK
    • DF: DeFault

    I generally want to group metadata/system catalog data by the controlling object rather than by object type.

提交回复
热议问题