in reply to perl create database with folder system
My first idea was that you want to implement a database just using the file system.
But now I think you are asking about how to implement tree structures in an SQL table.
This is speculation and we are primarily a Perl board, but table like this should do:
id parent value 1 0 animal 2 1 cat 3 2 lion 4 2 tiger 5 4 Siegfried 6 4 Roy
For instance the path structure /animal/cat/tiger/Roy is represented in the former table.
There are different ways how to query this, like recursively or using self joins.
You can also use a view based on self join if the tree's depth is fixed in order to visualize the path structure.
Cheers Rolf
(addicted to the Perl Programming Language and ☆☆☆☆ :)
Wikisyntax for the Monastery
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: perl create database with folder system (Tree in SQL)
by choroba (Cardinal) on Dec 02, 2017 at 15:17 UTC | |
by LanX (Saint) on Dec 02, 2017 at 15:36 UTC |