First page Back Continue Last page Image

Example: After Trigger which audits trigger events

CREATE TABLE invoices_audit

(

vendor_id INT NOT NULL,

invoice_number VARCHAR(50) NOT NULL,

invoice_total DECIMAL(9,2) NOT NULL,

action_type VARCHAR(50) NOT NULL,

action_date DATETIME NOT NULL

)

Since the triggers are running without human intervention, you may want to keep a record of the changes in case you need to review them later

We can start by creating an Audit table as show below