Title: SQL Server-XML-Lesson 8-Grouping sets and triggers
Duration: 19 minutes
Summary: In this video, we discuss grouping sets and triggers. First, we start with Grouping sets to group the ProductId, and SpecialOfferId in the Sales.SalesOrderDetail table. We saw how we can use the () to show the total sum. Then, we added the having clause with the Grouping_Id to control whether to display/hide the total sum. Finally, we moved to triggers. Triggers are automatically called when a certain event happens. In this case, we tried to handle the ‘After Update” event on the Customers table. When we update the Customers first name, the trigger will fire and the ModifiedBy field is updated by the trigger. When using trigger, we automatically have access to the Inserted and Deleted tables to control what has been inserted and deleted from the target table.
Methodology of the development of example: Good coding standard and simplified design to illustrate the key points.
Technology Used: SQL Server 2008.
Keywords: table, database, primary key, Grouping sets, Grouping_Id, trigger, after update, varchar.