Re: Creating views (Multiple Databases) - Mailing list pgsql-general

From Michael Glaesemann
Subject Re: Creating views (Multiple Databases)
Date
Msg-id B54CA0D6-01DE-488B-9D0C-FF5149992CC0@myrealbox.com
Whole thread Raw
In response to Creating views (Multiple Databases)  (Benjamin Arai <barai@cs.ucr.edu>)
List pgsql-general
On Feb 2, 2006, at 16:05 , Benjamin Arai wrote:

> Is it possible to create a view from two different database tables?

Yes. You can create a view out of any query (i.e., SELECT statement).
For example,

CREATE VIEW companies__members__view AS
SELECT company.company_name, member.given_name, member.family_name,
FROM companies
JOIN companies__members USING (company_id)
JOIN members USING (member_id);

Here's a couple of links to some of the documentation on views:
http://www.postgresql.org/docs/current/interactive/sql-createview.html
http://www.postgresql.org/docs/8.1/interactive/tutorial-views.html

Between different *databases* is another issue. You'll need to look
at something like dblink (in contrib). If you think you might be
doing this a lot you might want to consider making one database,
separating out different sections in different schemas as necessary.

Hope this helps.

Michael Glaesemann
grzm myrealbox com




pgsql-general by date:

Previous
From: Benjamin Arai
Date:
Subject: Creating views (Multiple Databases)
Next
From: "A. Kretschmer"
Date:
Subject: Re: Creating views (Multiple Databases)