How to use HierarchyID data type in SQL Server using real world example

preview_player
Показать описание
This is a 15 minute video. If you truly want to MASTER this datatype, you should watch the entire video. I leave no feature out, and you will become the expert on this data type.

Hierarchical data is a data structure when items are linked to each other in parent-child relationships in an overall tree structure. Think of data like a family tree, with grandparents, parents, children, and grandchildren forming a hierarchy of connected data.

In this video, everything is new. We create a new table, uses only three columns, and then step-by-step show you how to insert, select, getLevel(), GetAncestor(), GetDescendant(c1,c2) and perform a recursive CTE.

Step-By-Step to explain the recursive CTE. I will leave no programmer behind. You will understand this CTE.

Step-By-Step how to add new nodes to the object. You will master this ability.

TimeLine
00:21 - Step 1, Create table, insert hierarchy data, GetLevel(),GetAncestor()
05:28 - Step 2, GetAncestor()
08:16 - Step 3, Write recursive CTE, show step-by-step
10:25 - Step 4, GetDescendant(), insert, insert between

What is an example of a hierarchical data: company org chart

Set of data items that are related to each other by hierarchical relationships.
Watch this Hierarchical data type example in Sql Server.

#softwareNuggets, #sqlServer, #hierarchyId, @SoftwareNuggets
Рекомендации по теме
Комментарии
Автор

Exactly what I was looking for. Anticipated my insert question. Brief and clear. Many thanks!

deaconjohnbeagan
Автор

Thank you! Really interesting. Good job!

FernandoLopez-elmp