I hava a Customer table, which has a column to show whether the customer is “AllowRefund”, and must have a column By_Which_Staff to indicate which staff credits the privilege of “AllowRerfund”.
My requirement is: Before I put the staff Id into By_Which_Staff table, the DB should first check if the column AllowRefund is Yes, then the staff Id can be put in it.
This is should be a constraint. Triggers should only be used when you are acting on (or at least making use of) something outside the current row.
Constraints should be used for unacceptable values (negative ages, k1 students more than 18), and calculated values should be used for composite values (full name for instance).