Search Postgresql Archives

Re: Creating views (Multiple Databases)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




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





[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux