Constraints and Guidlines
Filed in Sybase on May.12, 2009
Standards to create the constraints
Rule
- Each table must have one or more unique identifiers. At least one must be implemented as a primary key.
- The unique identifier must have true business meaning where possible, and not simply be a generated sequence number. A surrogate key may be used where performance considerations would warrant it.
- If relationships exist between tables then they should be enforced using a foreign key constraint (unless triggers are being used to enforce advanced RI)
- Check constraints must be used to restrict the allowable values of columns for appropriate business rules where the list of values is relatively small.
Guidlines
- Primary keys constraints should be named PK_<table name>
- Alternate/unique constraint should be named AK_<table name>_<seq>
- Foreign keys constraints should be named FK_<table name>_<seq>
- Default constraints should be named DF_<constraint name>
- Check constraints must be named CC_<constraint name>


Leave a Reply