On Tue, Mar 27, 2018 at 8:22 PM, Ian Zimmerman <[email protected]> wrote:
> On 2018-03-27 19:26, Keith Medcalf wrote:
>
> > Actually, it is very simple and straightforward to implement
> > hierarchical structures using Relational Database Models.
>
> But not recursive structures (or to be more precise, recursive queries)
> which are the next very natural step.
>
> You can have a "parent" database and you can use it to answer queries
> like "all X, Y where X is a parent of Y", "all X, Y where X is a
> grandparent of Y", "all X, Y where X is a great-grandparent of Y" etc.
> All that with a single table. But no amount of SQL mastery will allow
> you to answer "all X, Y where X is an ancestor of Y".
>
that's where CTE queries come in... something like....
create table jsonMap(node_id,parent_id,fieldName, value );
WITH temp as(
SELECT * FROM jsonMap x
WHERE parent_id=X
UNION ALL
SELECT om.* FROM jsonMap om
INNER JOIN temp x ON om.parent_id = x.node_id
)
SELECT * FROM temp
> --
> Please don't Cc: me privately on mailing lists and Usenet,
> if you also post the followup to the list or newsgroup.
> To reply privately _only_ on Usenet and on broken lists
> which rewrite From, fetch the TXT record for no-use.mooo.com.
> _______________________________________________
> sqlite-users mailing list
> [email protected]
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>
_______________________________________________
sqlite-users mailing list
[email protected]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users