Problem
We would like to create the database trigger to automatically verify the following consistency constraint. An order submitted by a customer can be handled only by an employee from the same country as the customer who submitted the order.
Download a template for SQL script available in a file solution2.sql and insert into the template the implementations of the actions listed below. All implemented actions must directly follow a respective comment with a specification of an action.
i. First, the script inserts into a database information about two customers from two different countries, information about two employees from the same countries as customers and information about one shipper.
ii. Next, the script creates a statement trigger, that automatically verifies a consistency constraint listed above. If a consistency constraint is violated then a modification of sample database, that fired a trigger must fail and an error message must be displayed. In this particular case it is the "good error"
iii. Next, the script comprehensively tests the trigger. The tests must include at least one modification of a sample database that fires a trigger and such that the verification of the consistency constraint does not fail the modification. The test must also include at least one modification of a sample database that fire a trigger and such that verification of the consistency constraint fails the modification.
iv. Finally, the script removes from a data dictionary a trigger created in a step (2).