Describe what should be considered when enforcing business rules with triggers.
Because triggers automatically perform an action after a change is made to your database, they are an important method for enforcing the business rules that govern your database.
Business rules govern the conditions that must be met for a company’s policies to be enforced.
Following are examples of business rules that are good candidates for enforcement with triggers:
- No employee can have a salary greater than $200,000 without the approval of a manager. The manager’s employee ID must be stored toprove that this salary was authorized.
- Whenever a sales transaction is greater than $50,000, the company president must be notified so that the salesperson can be personally congratulated.
- A sale cannot be made for an item that is NOT in inventory, unless the InventoryType field has a value of
B
.
All these rules can be enforced by using triggers. The rest of this module shows you how to do this.
In the next lesson, the creation of triggers will be discussed.