Skip to main content
HomeSQL

Course

Hierarchical and Recursive Queries in SQL Server

AdvancedSkill Level
4.8+
135 reviews
Updated 03/2023
Learn how to write recursive queries and query hierarchical data structures.
Start Course for Free
SQLProgramming4 hr13 videos47 Exercises3,800 XP12,558Statement of Accomplishment

Create Your Free Account

or

By continuing, you accept our Terms of Use, our Privacy Policy and that your data is stored in the USA.

Loved by learners at thousands of companies

Group

Training 2 or more people?

Try DataCamp for Business

Course Description

Do you want to query complex data structures in an iterative way? Do you have access to hierarchical data structures that need to be queried? This course will teach you the tools required to solve these questions. You will learn how to write recursive queries and query hierarchical data structures. To do this, you will use Common Table Expressions (CTE) and the recursion principle on a wide variety of datasets. You will, for example, dig into a flight plan dataset and learn how to find the best and cheapest connection between two airports. After completing this course, you will understand the principle of recursion, and be able to identify and create hierarchical data models.

Prerequisites

Functions for Manipulating Data in SQL Server
1

Recursion and Common Table Expression (CTE)

In this chapter, you will learn about recursion and why it is beneficial to apply this technique. You will also refresh your knowledge about Common Expression Tables (CTE).
Start Chapter
2

Hierarchical and Recursive Queries

3

Creating Data Models on Your Own

4

Hierarchical Queries of Real-World Examples

Hierarchical and Recursive Queries in SQL Server
Course
Complete

Earn Statement of Accomplishment

Add this credential to your LinkedIn profile, resume, or CV
Share it on social media and in your performance review
Enroll Now

Don’t just take our word for it

*4.8
from 135 reviews
84%
14%
2%
0%
0%
  • Rushi
    22 hours ago

  • Jennifer
    3 days ago

    Would like more practice.

  • Teresa
    4 days ago

  • Giang
    last week

  • Wenhai
    2 weeks ago

  • Adama
    2 weeks ago

Teresa

Giang

Wenhai

FAQs

Is this course suitable for beginners?

Yes! This course is suitable for beginners looking to learn about how to query hierarchical and recursive data structures. It starts from the basics of Common Table Expressions and recursion principle, so no prior experience is required.

Will I receive a certificate at the end of the course?

Yes! You will be awarded a certificate of completion upon completion of the course.

Who will benefit from this course?

Any job that requires querying data structures or working with hierarchical or recursive data would be a great fit for this course. This could include roles such as data analyst, software engineer, database administrator, etc.

What are Common Table Expressions (CTE)?

Common Table Expressions (CTEs) are statements that let you define a temporary result set that can be referenced further in the same statement. It can be used in other parts of a larger SQL query to make it easier to read.

What is the Recursion Principle?

The recursion principle is the idea of breaking down a complex problem into smaller, simpler problems that can then be used in a recursive fashion to solve the larger problem. It is a useful approach for solving hierarchical or recursive data problems.

What will I learn in the Creating Data Models chapter?

In this chapter, you will learn how to create and modify database tables. You will also refresh your knowledge about relational and hierarchical data models, and learn when each model should be used.

What kind of real-world examples can I expect in the Hierarchical Queries chapter?

In this chapter, you will be presented with real-world problems such as finding possible flight routes, assembling a car, and modeling a power grid, and you will be taught how to apply recursive CTEs on hierarchical data to solve these problems.

Join over 19 million learners and start Hierarchical and Recursive Queries in SQL Server today!

Create Your Free Account

or

By continuing, you accept our Terms of Use, our Privacy Policy and that your data is stored in the USA.

Grow your data skills with DataCamp for Mobile

Make progress on the go with our mobile courses and daily 5-minute coding challenges.