> On Mar 18, 2019, at 5:21 AM, Keith Medcalf wrote:
>
> UPDATE tree
> SET position = (SELECT position FROM _children WHERE id = tree.id) --
> Multiply by x to number by x
> WHERE id IN (SELECT id FROM _children);
> DELETE FROM _children;
> END;
I don’t see the window function causing
On Mon, Mar 18, 2019 at 10:21 AM Keith Medcalf wrote:
> requires a "gentlemen's agreement" to only put positive values in the
> position column (meaning the database cannot enforce this, you need to do
> it at the application level)
>
Can't this be done with a before insert trigger?
sqlite>
icipated traffic volume.
>-Original Message-
>From: sqlite-users [mailto:sqlite-users-
>boun...@mailinglists.sqlite.org] On Behalf Of Joshua Thomas Wise
>Sent: Monday, 18 March, 2019 01:09
>To: SQLite mailing list
>Subject: Re: [sqlite] Recursive CTE on tree with
Another way of implementing ordered siblings is to use a floating point
“position” column instead of maintaining links to siblings via foreign keys.
The advantage of a “position” column is that the data model maintains
consistency automatically—you don’t need to painstakingly make sure all
On Mon, 11 Mar 2019 10:39:06 +0100
Jean-Luc Hainaut wrote:
> Your implementation of trees is that of network databases at the
> pointer-based physical level but definitely not relational. Try this:
>
> create table TREE(
>ID integer not null primary key,
>Parent integer references
On Monday, 11 March, 2019 09:42, heribert wrote:
>it works perfect - but i do not understand why.
See https://sqlite.org/lang_with.html for a description of recursive queries ...
>The 'inital-select' results with the head node - only one result set.
>SELECT *
> FROM Tree
> WHERE
Thx clemens,
it works perfect - but i do not understand why.
The 'inital-select' results with the head node - only one result set.
SELECT *
FROM Tree
WHERE ParentIDX = (SELECT ParentIDX
FROM Tree
WHERE ID = 3)
AND PrevIDX IS NULL
Points
heribert wrote:
> I've a tree with doubly linked items. I want to get all siblings of a tree
> node.
If you want them in order, you have to walk through the linked list:
WITH SiblingsOf3 AS (
SELECT *
FROM Tree
WHERE ParentIDX = (SELECT ParentIDX
FROM Tree
Your implementation of trees is that of network databases at the
pointer-based physical level but definitely not relational. Try this:
create table TREE(
ID integer not null primary key,
Parent integer references TREE on delete ... on update cascade); --
Notice the absence of "not null"
I've a tree with doubly linked items. I want to get all siblings of a
tree node (e.g. ID=2 or harder to implement ID=3).
I tried to solve this problem with CTE of SQLite by myself - but I can
not find the solution. I looked for any exemplary solution - but do not
find some.
DROP TABLE IF
10 matches
Mail list logo