Skip site navigation (1) Skip section navigation (2)

Database Views

From: "gcj" <gauss21(at)comcast(dot)net>
To: <pgsql-novice(at)postgresql(dot)org>
Subject: Database Views
Date: 2008-11-06 17:21:11
Message-ID: 4511590CFED74D9CB834E0263273DA01@Serotonin (view raw or whole thread)
Lists: pgsql-novice


I'm a java developer and a novice Postgres user.  I'm trying to create a
view that will display common fields from several different tables to
simplify some JDBC queries.


To illustrate my question, consider this example -- I have the following
three tables:






Although the tables contain numerous columns each, they each contain the
following columns in common:



Identification Number



I would like to create a view that will display this common information as
well as a column called "Type" that will indicate what kind of record it is
- eg Car, Truck, or SUV.


I'm not trying to create a view that merges multiple rows into a single row
in the view, but instead a view that will display a subset of each row from
the different tables.  For example, if each of the individual tables
contains 100 rows, the view would contain 300 rows.


I have no problem creating a view that queries a single table, but I get
stuck when trying to pull multiple tables into the view.


Can this type of view be created?  If so, can someone point me in the right
direction - a keyword or syntax example would be appreciated.







pgsql-novice by date

Next:From: Frank BaxDate: 2008-11-06 17:45:38
Subject: Re: Database Views
Previous:From: LevĂ­ Teodoro da SilvaDate: 2008-11-06 11:50:35
Subject: [DUMP] Make a dump with special characters

Privacy Policy | About PostgreSQL
Copyright © 1996-2015 The PostgreSQL Global Development Group