Triggers In SQL Server | SQL Interview questions and answers for freshers
Sep 21 2021

Sudhir Kumar

Understanding of triggers in SQL Server. Overview of trigger groups, magic tables, DML triggers with the use case, and real examples.A SQL Server trigger is like a stored procedure that executes when a given event happens. There are mainly 3 groups of triggers in the SQL server1. DDL - Data definition language - fires upon when there is a change in structure like creating, modifying, or dropping (CREATE, ALTER, and DROP) a table.2. DML - Data modification/manipulation language - fires when an insert, update or delete statement is executed on a table or a view.3. Logon triggers - fires when the LOGON event happens. This event is raised when a user session is created with an instance of SQL Server. Logon triggers fire after the authentication phase of logging finish, but before the user session is actually established.See the below video to learn DML Triggers which are categorized into two: 1. AFTER trigger 2. Instead of trigger