Skip to main content
Jiaxun Hao avatar

Jiaxun Hao has completed

Hierarchical and Recursive Queries in SQL Server

Start course For Free
4 hr
3,800 XP
Statement of Accomplishment Badge

Loved by learners at thousands of companies


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.
For Business

Training 2 or more people?

Get your team access to the full DataCamp platform, including all the features.
DataCamp for BusinessFor a bespoke solution book a demo.
  1. 1

    Recursion and Common Table Expression (CTE)

    Free

    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).

    Play Chapter Now
    Recap of Common Table Expressions (CTE)
    50 xp
    What is a CTE?
    50 xp
    A CTE for IT-positions
    100 xp
    A CTE for high-paid IT-positions
    100 xp
    Introduction to recursion
    50 xp
    Facts about recursion
    50 xp
    Calculate the factorial of 5
    100 xp
    How to query the factorial of 6 recursively
    100 xp
    Solve recursive maths problems
    50 xp
    Counting numbers recursively
    100 xp
    Calculate the sum of potencies
    100 xp
  2. 4

    Hierarchical Queries of Real-World Examples

    In this chapter, you will practice your learnings about hierarchical and recursive querying on real-world problems, such as finding possible flight routes, assembling a car, and modeling a power grid.

    Play Chapter Now
For Business

Training 2 or more people?

Get your team access to the full DataCamp platform, including all the features.

datasets

Power grid dataEmployee dataDepartment dataSalary dataBill of materials products dataBill of materials dataFlights data

collaborators

Collaborator's avatar
Mona Khalil
Collaborator's avatar
Sara Billen
Collaborator's avatar
Alex Yarosh
Collaborator's avatar
Dominik Egarter
Jasmin Ludolf HeadshotJasmin Ludolf

Senior Data Science and AI Content Developer, DataCamp

Jasmin is a Senior Content Developer at DataCamp. After ten years as a global marketing manager in the music industry, she changed careers to follow her curiosity for data. Her passion is value exchange and making data science and AI accessible to all.
See More

Join over 17 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.