Re: data extraction based on primary key/foreign key constraints

From: news <x_at_y.com>
Date: Thu, 04 Apr 2002 16:31:58 GMT
Message-ID: <2e%q8.138016$u77.31597115_at_news02.optonline.net>


I am not sure I completely understand your question, but I will give it a shot. I am not sure what you mean by extract. I am going with the assumption that you mean query and not export. If this is the case, you are looking at a join condition in a query. What you would do is say the following:

select a. value1, a.value2, b.value1, b.value2... from primary_table a, foriegn_table b
where a.pk = b.fk;

Of course, replace primary_table with the name of your table containing the primary key and foriegn_table with the table containing the foriegn key. Replace pk with the actual field name of the primary key and fk with the field name of the foriegn key. You could easily put this into a view and just say select * from view. You would create the view by executing the following code:

CREATE OR REPLACE VIEW view_name as
select a. value1, a.value2, b.value1, b.value2... from primary_table a, foriegn_table b
where a.pk = b.fk;

This would make it seem as though your data is stored within a single data, thus making it much simpler for querying (extracting). I hope this answered your question. If not, please repost.

John

"Chris Baugh" <chrislbaugh_at_hotmail.com> wrote in message news:f99e10b9.0204040539.1ac112e8_at_posting.google.com...
> Does anyone know a way of extracting data from tables based on primary
> key/foreign key constraints.
>
> ie. for a given table, and set of values within that table, is there a
> way of extracting data from tables linked to that table by way of
> primary key/foregin key constraints, so that any parent tables data,
> and all child tables data, for tables hierarchically linked to the
> orignal table, can be extracted.
Received on Thu Apr 04 2002 - 18:31:58 CEST

Original text of this message