The Application DBA  

Constraint Naming


The following recommendations cover the naming of database constraints.

bullet Name all constraints. No system named constraints are acceptable.
bullet Constraint names should use the table name and a constraint abbreviation. Where multiple constraints are allowed they are numbered sequentially for uniqueness.

The advantages of using just the table name, and not some abbreviation of table name and column names are that it's simpler to name. With the use of table name first it's easy to "group" tables, their indexes, and their constraints, and it's obvious which constraints belong to which table when viewing execution plans.

Naming Guidelines

Primary key constraints - <table name>_PK

Foreign key constraints - <table name>_FK{#}

Unique constraints - <table name>_UQ{#}

Check constraints - <table name>_CK{#}

Not null constraints - <table name>_NN{#}


Copyright 1998-2013 AppsDBA Consulting. All Rights Reserved.