Check out example codes for "triggers in sql". It will help you in understanding the concepts better.

Code Example 1

Trigger: A trigger is a stored procedure in database which automatically invokes whenever a special event in the database occurs. For example, a trigger can be invoked when a row is inserted into a specified table or when certain table columns are being updated.

create trigger [trigger_name] 
[before | after]  
{insert | update | delete}  
on [table_name]  
[for each row]  

1. create trigger [trigger_name]: Creates or replaces an existing trigger with the trigger_name.
2. [before | after]: This specifies when the trigger will be executed.
3. {insert | update | delete}: This specifies the DML operation.
4. on [table_name]: This specifies the name of the table associated with the trigger.
5. [for each row]: This specifies a row-level trigger, i.e., the trigger will be executed for each row being affected.
6. [trigger_body]: This provides the operation to be performed as trigger is fired

create trigger stud_marks 
before INSERT 
for each row 
set = Student.subj1 + Student.subj2 + Student.subj3, Student.per = * 60 / 100;

Code Example 2

CREATE TRIGGER trigger_name   
ON { Table name or view name }   
[ WITH <Options> ]  

Learn ReactJs, React Native from