Two table:
Customer: Cus_ID, Status
Payment: Pay_ID, Cus_ID, PaidOrNot
Requirement is when setting “Yes” to “PaidOrNot”, then automatically set the Customer Status to “VIP”.
CREATE TRIGGER AutoVIP
AFTER UPDATE OR INSERT ON Payment
BEGIN
IF PaidOrNot = Yes
THEN UPDATE Customer set Status = VIP
END
I am quite not familiar with SQL syntax, this trigger seems not working, can you help me to amend it? Thanks.
What happens if you try this?
I have deliberately tried to make it as self-explanatory as possible.