CURSOR
- A cursor in MySQL is a database object used to retrieve and process each row of a result set individually.
- It is mainly used in stored procedures when we need to perform operations row by row.
To demonstrate a cursor with condition lets create and insert into the table.
Cursor example - Display Employee Names whose Salary > 50000
Call the Cursor Procedure
TRIGGER
- A trigger in MySQL is a stored program that automatically executes (fires) when a specified event occurs on a table, such as INSERT, UPDATE, or DELETE.
To demonstrates an AFTER INSERT trigger (with audit logging) lets create and insert into the table.
Create AFTER INSERT Trigger
Insert Sample Students to See Trigger in Action
Check the Audit Table
Top comments (0)