Questions tagged [hierarchical-data]

Hierarchical data reflects a set of parent-child relationships. These can be found in a genealogy, a taxonomy, a list of requirements for parts assembly, and innumerably other instances. Methods for dealing with hierarchical data are often essential for data management and analysis.

Hierarchical data reflects a set of parent-child relationships. As Materials Resource Planning was developed by manufacturers in the 1950s, hierarchical data management emerged as a theoretical and practical discipline. A manufacturer uses the term Bill of Materials (BOM) for the set of items required to assemble a parent item; the term BOM was adopted by mathematicians and software developers, and it is used today in both realms.

Hierarchical data is ubiquitous and has called forth some of the most important and complex work of database management. It has also propelled object-oriented programming.

The key design element is recursion. Imagine starting at the trunk of a tree and visiting every leaf; this theoretical exercise would require an enormously large number of decision points occurring in a nested or recursive pattern. Requirements for this analysis are remarkably varied and have produced entire sub-disciplines of database design.

2030 questions
0
votes
0 answers

How to a query to count values in a hierarchy tree

First off all, english is not my first language. So, sorry if a make any mistakes. I did a query in MySQL to find the nodes in a hierarchytree table and found something like this (Table1) like this: Hierarchy1id | Hierarchy 2id| Hierarchy3id|…
0
votes
1 answer

Find all parents for a child with lookthru path and other columns in python

I am really a newbie in python. Could you please help in the following problem I have the following table: Parent Child value 1 Value 2 a0 b1 0.2 5 b5 c1 0.3 2 a0 b2 0.5 6 a1 b3 …
0
votes
1 answer

How to turn this cursor operation into a set based operation on a closure hierarchy?

Trees.DirectReports is a closure (hierarchy) table. There is a table called Users with: RowID, EmployeeId, and MangerId. @RowCount is the number of records in this table and #EmpMgr is a cursor for this table. Below is the relevant sql code that I…
0
votes
1 answer

Joining hierarchical data to another table in R

I have 2 data frames (drug and class) which I need to join by last level of ATC classification code and also add 4 additional columns with corresponding parent levels. I came up with 2 solutions, but first one is quite verbose and second one is…
Jakub Cee
  • 3
  • 3
0
votes
3 answers

Swifty JSON: convert hierarchical list of objects in JSON arrays to hierarchical Swift objects

I have a below JSON format which belongs to a shop which inside this json object, Data field is a JSON array consists of a hierarchy of product categories which categories are stored in a nested hierarchical format (Each category have children and…
VSB
  • 9,825
  • 16
  • 72
  • 145
0
votes
0 answers

How to find all the employees that under a manger who is also an employee in mySQL version 5.7.22 without using CTE and no pre defined manager level?

ManagerId is nothing but EmpId. i need all the EmpId that come under the given EmpId including all the subtree. without using CTE as i'm trying this with HQL. with no hierarchy level defined. +-------+-----------+ | EmpId | ManagerId…
BlueMoon
  • 33
  • 4
0
votes
1 answer

How to traverse rows in a table as a Tree

I have a table with two columns: child and parent. This table represents a tree kind structure having multiple trees. Given any child, i need to find its root. In other words, I need to get the parent of that child, and then the parent of the parent…
SpaceyBot
  • 482
  • 1
  • 4
  • 20
0
votes
0 answers

Is there a way in SQL to identify and tag trees containing circular relationships?

I do have a large sql table (from the automotive industry) containing information similar to the following format: NAME ID PARENTID CHILDID IN_LAW_ID ---------- ---------- ---------- ---------- ---------- Bill …
alec
  • 1
0
votes
1 answer

Fetch email thread from a table with recursive query

I have a table emails: id message_id in_reply_to 1 null 2 3 4
Coder
  • 540
  • 1
  • 11
  • 34
0
votes
2 answers

LDAP Schemas and Tree Structure

How does LDAP define which enties may be places where in the tree ? I noticed that OpenLDAP prevents me from placing a 'bootableDevice' below an 'organizationalUnit', but 'inetOrgPerson'. Logically that makes sense, but how is this enforced in the…
Gene Vincent
  • 5,237
  • 9
  • 50
  • 86
0
votes
0 answers

Creating a view from a hierarchical query in Oracle SQL

I have sample data that shows a hierarchy between labs (locations). CREATE TABLE "DEMO"."LABS" ( "LABID" VARCHAR2(20 BYTE), "PARENT" VARCHAR2(20 BYTE) ) A lab has a single parent and therefore n ancestors. I found a way to figure…
David Brossard
  • 13,584
  • 6
  • 55
  • 88
0
votes
1 answer

Create recursive query for tree like data set

| Col1 | Col2 | Col3 | Col4 | Col5 -------------------------------------------------- | B1 | A1 | somedata | data | somedata | B2 | A1 | somedata | data | somedata | B3 | A1 | null | data |…
kratos24
  • 25
  • 7
0
votes
2 answers

SQL Server : graph/hierarchy SQL structure

After N hours of designing, how to save structure like this into a relational database (SQL Server). I ended on this structure, but it is not really good. create table [OperationalModel] ( [Id] int, [Name] varchar(150), [Code]…
Glock
  • 63
  • 4
0
votes
1 answer

Query to find folder path and leaf node ID

I have table as I want to create SQl or Procedure to fetch values as below FolderPath LeafFolderID Dept/CSE/Cfolder 100 Dept/Mech 10 Team/HR 22 Settlement 3 Please let me know how to achieve…
nkm
  • 53
  • 1
  • 8
0
votes
1 answer

Flex AdvancedDataGrid HierarchicalData XML results in unwanted rows

I guess the best way to explain my issue is to describe it in terms of the hierarchical XML data example on Livedocs. Here, the XML is of the form
Marc
  • 104
  • 1
  • 10