Howdy!

We are making some progress here.

However, I have some concerns.

You say:

sector(s_id, d_id, name); department(d_id, dd_id, name); division(dd_id, ... , name);

That looks a bit backwards from a normalization point of view. It appears that the higher level entity contains a pointer to the lower level entity, which is exactly backward from how it ought to be.

Consider:

sector(s_id, name, ...) department(d_id, s_id, name, ...) division(dd_id, d_id, name, ...)

In this rough schema, a department has a sector ID. In your schema, either a sector has to have multiple columns for department IDs or there have to be duplicate sector entries if a sector has more than one department.

Now, to get back to your actual question, if your requirement is simply to be able to use DBI, then without prior knowledge of the set of tables, you cannot depend on being able to discover the relationships, since not all DBDs offer that kind of support (DBD::CSV, DBD::RAM, for instance).

If you must use DBI with any arbitrary DBD for the data store, you will have to know up front the set of tables to examine. You won't even be able to count on getting a list of tables in the "database".

yours,
Michael


In reply to Re: Re: Re: How to display all the content of the database? by herveus
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.