[colug-432] Show Parent/Child Relationships of Database Tables

Tom Hanlon tom at functionalmedia.com
Tue Aug 11 17:55:39 EDT 2015


Information_schema that shows Foriegn Key constraints should be more or
less standard across RDBMS.

Something like this might be a start.

select
    concat(table_name, '.', column_name) as 'foreign key',
    concat(referenced_table_name, '.', referenced_column_name) as
'references'from
    information_schema.key_column_usagewhere
    referenced_table_name is not null
    and table_schema = 'my_database'
    and table_name = 'my_table'


On Tue, Aug 11, 2015 at 5:11 PM, Pat <pat at linuxcolumbus.com> wrote:

> Would be easy enough to script via the DB metadata.   I use squirrel-sql
> for most DB tasks since it supports most databases via jdbc.
>
> Pat
>
> On 2015-08-11 12:24, jep200404 at columbus.rr.com wrote:
> > What program shows the parent/child relationships for all the
> > tables of a database? I am looking for a program that would have
> > plain text output, with one table name on each line, and
> > indentation indicating the parent/child relationship
> > in an outline kind of format.
> > I have not found good results searching the web,
> > not even of GUI tools.
> >
> > I am using postgresql, but a nice program would work with
> > other database software, such as MariaDB, also.
> > _______________________________________________
> > colug-432 mailing list
> > colug-432 at colug.net
> > http://lists.colug.net/mailman/listinfo/colug-432
> _______________________________________________
> colug-432 mailing list
> colug-432 at colug.net
> http://lists.colug.net/mailman/listinfo/colug-432
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.colug.net/pipermail/colug-432/attachments/20150811/c85e520d/attachment-0001.html 


More information about the colug-432 mailing list