Practical No 9: Trigger
Practical No 9: Trigger
THEORY:
TRIGGER:
A function is compiled and executed every time whenever it is called. A function must return a
value and cannot modify the data received as parameters. For more about functions, please refer
to the article Different types of Functions.
SYNTAX:
TRIGGER:
A trigger is a special type of stored procedure that automatically runs when an event occurs in the
database server. DML triggers run when a user tries to modify data through a data manipulation
language (DML) event. DML events are INSERT, UPDATE, or DELETE statements on a table or
view. These triggers fire when any valid event fires, whether table rows are affected or not.
SYNTAX:
OUTPUTS:
FOR FUNCTION
select s_name('2018ACSC110','Rahul','MTech');
select * from student1;
FOR TRIGGER