Constraint Naming Conventions
Doesn't really matter how you feel about this as long as you are consistent. I picked this up from comments on Dizwell's site and I basically like it. The only thing I change is the use of table names except in the case of foreign keys.
- Each table has a full name (employee) and a short name (emp) of three or four characters.
- Each PK is named PM_short_name, so PK_EMP.
- Each FK is named FK_parent_short_name_child_short_name and if more than one required, an additional sequence number is added as a suffix. So, FK_EMP_DEPT.
- Check constraints are CHK_short_name_column_name - if at all possible. Alternatively, CHK_short_name_reason if it fits. Example, CHK_EMP_NAME or CHK_EMP_NAME_PRESENT.
- Unique constraints are UQ_short_name_column where possible or UQ_SHORT_NAME_reason. For example, UQ_EMP_EMAIL.
