Here is another popular lab from Hands-On-Lab library: LAG and LEAD Functions in SQL Server.
In Transact-SQL (T-SQL) 2012 LAG & LEAD are the new analytical functions. LAG access data from the previous row in the same result set without the use of self-join. LEAD access data from a subsequent row in the same result set without the use of self-join. This lab is divided into four exercises explaining LEAD and LAG functions such as compare values with in partitions using LAG & LEAD, difference within partitions using LAG & LEAD.
Exercise 1: compare values within partitions using LAG & LEAD
Exercise 2: Difference within partitions using LAG & LEAD
Exercise 3: Self-Assessment
Exercise 4: 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.
Happy Learning – The Practical Way.