Question : One column in my table stores list of values separated by comma (I know it’s a poor design, […]
Tag: hierarchy
MySQL function to return breadcrumb-like string from hierarchical structure
Question : Show create table: CREATE TABLE `a` ( `id` int(11) NOT NULL, `name` varchar(255) DEFAULT NULL, `parent_id` int(11) DEFAULT […]
Return hierarchical data from a self-referencing table (parents, children)
Question : I have the following SQL Server 2008 table and data: CREATE TABLE dbo.MyTable (Sno int, refid int); INSERT […]
Is the hierarchyid CLR open-source?
Question : The built-in hierarchyid is a CLR that stores paths in an efficient binary form, and provides other useful […]
SQL Variables inside SELECT query in a function
Question : MariaDB 10.3.14 I have a function that generates the root id in a hierarchy: The function is this: […]
Unflatten hierarchical data in SQL Server
Question : I have some tables in the staging area of a data warehouse that I’m filling with data from […]
Social network comments and posts model in PostgreSQL 9.6
Question : I’m trying to figure out a data structure for migrating from MongoDB to PostgreSQL. Within my posts table […]
Get top most parent by nth child id?
Question : Now there is a question we commonly use this technique to maintain the parent child relation i.e we […]
SQL relationship for nested groups
Question : I’m working on a creating a database schema for a legacy app that currently saves its data to […]
How can I limit a hierarchical query to the point where there are multiple children?
Question : This question is related to my previous question about hierarchical queries. I have a hierarchical query in Oracle […]