I agree with you completely, seems that the person who designed the database has no database experience....

In Oracle I would do:

create table organization( orgid number not null primary key, ordparent number, orgname varchar2(40) not null); alter table organization add constraint fk_parent foriegn key (orgpare +nt) references organization(orgid); -- start inserts for organizations insert into organization ....etc. -- end inserts for organizations create table orglevels( levelid number not null, levelname varchar2(20) not null); insert into orglevels values (1,'Sector'); insert into orglevels values (2,'Department'); insert into orglevels values (3,'Division');

You would probably get lots of data by running a query like this one (untested):

select orgid,orgname,orgparent,level,l.levelname from organization o s +tart with orgparent is null connect by prior orgid=orgparent left join orglevels l on l.levelid=level

In reply to Re: Re: How to display all the content of the database? by osama
in thread How to display all the content of the database? by Alex the Serb

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.