MySQL Forums
Forum List  »  Newbie

Re: Return the level and count of a closure table.
Posted by: Peter Brawley
Date: May 06, 2009 04:53PM

The tree you draw ...
      1
     / \
    2   4
    |   |
    3   7
   /|\
  5 8 6
would ordinarily be represented as an edge list (http://www.artfulsoftware.com/mysqlbook/sampler/mysqled1ch20.html):

drop table if exists my_tree;
create table my_tree( ancestor_id int, descendant_id int );
insert into my_tree values (1, 2),(1, 4),(2, 3),(3, 5),(3, 8),(3, 6),(4,7);

Is that what you mean? Otherwise, you'll have to disambiguate "hierarchical closure model".

PB
http://www.artfulsoftware.com

Options: ReplyQuote




Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.