From: | Michael Glaesemann <grzm(at)myrealbox(dot)com> |
---|---|
To: | Benjamin Arai <barai(at)cs(dot)ucr(dot)edu> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Creating views (Multiple Databases) |
Date: | 2006-02-02 07:15:53 |
Message-ID: | B54CA0D6-01DE-488B-9D0C-FF5149992CC0@myrealbox.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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
From | Date | Subject | |
---|---|---|---|
Next Message | A. Kretschmer | 2006-02-02 07:16:58 | Re: Creating views (Multiple Databases) |
Previous Message | Benjamin Arai | 2006-02-02 07:05:43 | Creating views (Multiple Databases) |