What trigger is?
Triggers are small programs that will execute at the time of any event occur. A trigger program contains database events like UPDATE, DELETE or INSERT queries. The trigger itself may execute before or after the query that initiates it.
I'll Explain it in a practical scenario:
Salea record table
records the amount of the sale (sale_amt), the date (date), the name of the salesman (name), his id number (employee_id), and the product id (prod_id). We'll call this table (cleverly enough) “sales”.
When a sale record is inserted in the sales table, the salesperson's totals must be updated in the performance table.
Here is the triggering sql:
No comments:
Post a Comment