Naming convention for unique constraint

My naming convention for indices and constraints:

Index/Constraint Type Naming Convention
Primary key <table-name>_PK
Unique index/constraint <table-name>_AK{xx}
Non-Unique index <table-name>_IX{xx}
Check constraint <table-name>_CK{xx}
Default constraint <table-name>_DF{xx}
Foreign key constraint <table-name>_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:

Suffix Meaning
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.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)