Movatterモバイル変換


[0]ホーム

URL:



Facebook
Postgres Pro
Facebook
Downloads
3.2. Views
Prev UpChapter 3. Advanced FeaturesHome Next

3.2. Views#

Refer back to the queries inSection 2.6. Suppose the combined listing of weather records and city location is of particular interest to your application, but you do not want to type the query each time you need it. You can create aview over the query, which gives a name to the query that you can refer to like an ordinary table:

CREATE VIEW myview AS    SELECT name, temp_lo, temp_hi, prcp, date, location        FROM weather, cities        WHERE city = name;SELECT * FROM myview;

Making liberal use of views is a key aspect of good SQL database design. Views allow you to encapsulate the details of the structure of your tables, which might change as your application evolves, behind consistent interfaces.

Views can be used in almost any place a real table can be used. Building views upon other views is not uncommon.


Prev Up Next
3.1. Introduction Home 3.3. Foreign Keys
pdfepub
Go to PostgreSQL 17
By continuing to browse this website, you agree to the use of cookies. Go toPrivacy Policy.

[8]ページ先頭

©2009-2025 Movatter.jp