Database Views

Поиск
Список
Период
Сортировка
От gcj
Тема Database Views
Дата
Msg-id 4511590CFED74D9CB834E0263273DA01@Serotonin
обсуждение исходный текст
Ответы Re: Database Views  (Frank Bax <fbax@sympatico.ca>)
Список pgsql-novice

Hi,

 

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:

 

CARS

TRUCKS

SUVS

 

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

 

Manufacturer

Identification Number

Color

 

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.

 

Thanks,

 

gcj

 

В списке pgsql-novice по дате отправления:

Предыдущее
От: "Leví Teodoro da Silva"
Дата:
Сообщение: [DUMP] Make a dump with special characters
Следующее
От: Frank Bax
Дата:
Сообщение: Re: Database Views