Thursday, June 30, 2016

What is hierarchical data?

Hierarchical data is a set of data related to each other by hierarchical relationships. Here are some examples:

•Parent ->Children->Grand children
•File system
•Projects tasks
•Links between web pages
•Organizational Structures

You create table in SQL Server with hierarchyID data type to describe data with hierarchical data structure.
Hierarchical data in SQL Servers was first introduced in SQL Server 2008 by providing the hierarchy data type. This data type allows you to store and query hierarchical data.

Here us a screen shot of a table being created with hierarchical data type:



Hierarchical Data           Level in Hierarchy
-----------------------------------------------------
John/Mary Parents             /
Their children                    /1/
Their grand children          /1/2/

A slash separates a parents from their children schematically shown for a family relationship:

No comments: