Here is another popular lab from Hands-On-Lab library: SQL Server DML Triggers.
A DML (Data Manipulation Language) trigger is a special type of stored procedure that fires when an Insert, Update, or Delete operation is performed on a database table. DML triggers are used to implement business rules when data is altered and to extend the integrity checking logic of Microsoft SQL Server constraints, defaults, and rules. This lab is divided into eight exercises explaining different types of DML triggers and their usage. In first exercise we will learn to create AFTER INSERT trigger. In second exercise we learn to create AFTER UPDATE trigger. In third exercise we will learn to create AFTER DELETE trigger. In fourth exercise we will to create INSTEAD OF INSERT trigger. In fifth exercise we will to create INSTEAD OF UPDATE trigger. In sixth exercise we will to create INSTEAD OF DELETE trigger. Seventh exercise is Self-Assessment, where a problem is given and you need to that on you own. Eighth exercise presents the TSQL-challenge that needs to be solved (slightly tougher than self-assessment).
Exercise 1: CREATE AFTER INSERT trigger
Exercise 2: CREATE AFTER UPDATE trigger
Exercise 3: CREATE AFTER DELETE trigger
Exercise 4: CREATE INSTEAD OF INSERT trigger
Exercise 5: CREATE INSTEAD OF UPDATE trigger
Exercise 6: CREATE INSTEAD OF DELETE trigger
Exercise 7: Self-Assessment
Exercise 8: T-SQL Challenge
SQLMaestros Hands-On-Labs enables the practical way of learning. Each lab document consists of multiple exercises and each exercise consists of multiple tasks. Apart from step-by-step instructions, the HOL document contains images, explanations, observations, notes, tips & tricks to ensure a great learning experience. With each lab, you can practice a specific concept step-by-step. With our HOL documents, you will get hands-on with hundreds of topics in SQL Server & Microsoft Data Platform. Learn More.