Whenever database is modified then triggers are fired based on the event set. Two logical tables are created when triggers are fired.
Types of triggers:
1. Insert trigger
2. Update trigger
3. Delete trigger
Let’s take a look and update trigger:
Column level update : Update trigger updates when any column is updated.
Table level update: Any value in table is modified.
Create trigger insert on <table name> for update as
if(select <value> from inserted)> 10
print ‘<value> should be less than 10‘
Now let’s take a look at the query for delete trigger:
create trigger insert on <tablename> for delete as
if(select count(*) from delete)>1
print ‘you can delete only 1 record’