A trigger that insures that the member balance in the Member
A trigger that insures that the member balance in the Membership table is not less than -20.00.
Solution
CREATE TRIGGER MembershipTrigger
 ON Membership
 AFTER INSERT, UPDATE
 AS
 BEGIN
 IF EXISTS(SELECT * FROM INSERTED WHERE balance < -20)
 BEGIN
 RAISEERROR(\"Balance cannot be less than -20\");
 ROLLBACK;
 END
 ELSE
 BEGIN
 IF EXISTS(SELECT * FROM UPDATED WHERE balance < -20)
 RAISEERROR(\"Balance cannot be less than -20\");
 ROLLBACK;
 END
 END;

