Welcome to our Recursive Queries in MS SQL Server course.
This course introduces a new element of T-SQL queries called the Common Table Expression and explains how to use it.
Common Table Expressions or CTEs have been available in SQL Server since SQL Server 2008.
CTEs, often simply called
WITH clauses, are essentially just named subqueries. They are a fairly new feature of SQL Server; with CTEs, you can break a long query into smaller chunks, which makes queries more readable. Unlike T-SQL subqueries, CTEs can be recursive, allowing the traversal of hierarchical models of enormous depth.
This course covers simple CTEs, nested CTEs, and recursive CTEs. You will learn how to manage your SQL queries with CTEs, how and when to nest CTEs, and how to use recursive CTEs to move through hierarchical data models.
In this first part of the course, you will test your knowledge of basic T-SQL. You need fundamental T-SQL knowledge to follow this course, which covers more advanced material. We assume that you know how to filter table rows, sort data, and use aggregate functions with
GROUP BY and
HAVING. You will also need skills in joining tables and in using subqueries and set operators.
Check your knowledge: start with our short quiz to test your T-SQL skills!