home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / database / 8915 < prev    next >
Encoding:
Internet Message Format  |  1993-01-08  |  2.6 KB

  1. Path: sparky!uunet!munnari.oz.au!bruce.cs.monash.edu.au!monu6!escargot!otto!dtb
  2. From: dtb@otto (David Bath)
  3. Newsgroups: comp.databases
  4. Subject: Re: Hierarchical Structures in RDBMS
  5. Date: 8 Jan 93 04:36:24 GMT
  6. Organization: RMIT Computer Centre
  7. Lines: 54
  8. Message-ID: <dtb.726467784@otto>
  9. References: <1993Jan6.094340.5870@devon.co.uk> <18335@autodesk.COM>
  10. NNTP-Posting-Host: otto.bf.rmit.oz.au
  11.  
  12. tchild@autodesk.com (Timothy Child) writes:
  13.  
  14. >In article 5870@devon.co.uk, don@duncan (Don Radvan) writes:
  15. >> 
  16. >> I have an interesting problem. I need to represent hierarchical data  
  17. >> structures within a relational db, but I need to do it in a way that  
  18. >> permits the user to create his own hierarchy. That is, I do not know the  
  19. >> structure of the hierarchy before hand. 
  20. >> 
  21. >> For example:
  22. >>     A user wants to organize various objects. These objects will  
  23. >> appear as leaf nodes in the user's own hierarchy. The user may choose many  
  24. >> different ways of organizing these objects, indeed, s/he may have many  
  25. >> simultaneous hierarchies of organization for each set of objects. What  
  26. >> results is a sort of directory tree. Each directory is a category of  
  27. >> objects and each "file" or non-directory entry in a directory is an  
  28. >> object. Given the objects of apples and oranges, we may get the following:
  29. >> 
  30. >>                                   Stuff
  31. >>                                     |
  32. >>                     --------------------------------
  33. >>                   Food                          Non-Food
  34. >>                     |
  35. >>             ---------------------- . . .
  36. >>          Fruit        Veggies 
  37. >>            |
  38. >>      -------------
  39. >>   Apples       Oranges
  40. >> 
  41. >> And so when s/he does a query such as the following:
  42. >>     select name where Food = "Fruit"
  43. >> or
  44. >>     select name where Stuff = "Food" AND Food = "Fruit"
  45. >> 
  46. >> we would get Apples and Oranges.
  47. >> 
  48.  
  49. > It's possible to model this problem with an RDBMS, but I don't know of
  50. > a STANDARD way to express the appropriate SQL to return the information
  51. > and I don't think there is one!  
  52.  
  53. ORACLE has a lovely CONNECT BY PRIOR clause that joins leaves to nodes.
  54.  
  55. Very sexy if you like trees.  I do not think other RDBMS have this
  56. facility short of doing it by hand (and blowing your cursor limit).
  57.  
  58.  
  59. David T. Bath    Email:dtb@otto.bf.rmit.oz.au    Phone:03-3477511
  60. Global Technology Corporation, 179 Grattan St, CARLTON, VIC, 3153, AUSTRALIA
  61. "Failure to emulate is the best revenge" - Marcus Aurelius
  62. -- 
  63. David T. Bath    Email:dtb@otto.bf.rmit.oz.au    Phone:03-3477511
  64. Global Technology Corporation, 179 Grattan St, CARLTON, VIC, 3153, AUSTRALIA
  65. "Failure to emulate is the best revenge" - Marcus Aurelius
  66.