8.2. Working with Views

The way you look at your data affects the way you can process the data in your database. Looking at your data starts with building a model of a piece of reality and does not end with writing queries.

Certain database models allow certain ways of accessing the data. If the model of your data is a good one, you will be able to retrieve the information you need in most cases. However, in some situations it is necessary to change the way you look at your data. In that case, you should consider working with views.

Views are virtual tables that can be used to select data just as you would with ordinary tables. For the user a view is a table that contains the result of a SELECT statement. This way SELECT statements can be used ...

Get PHP and PostgreSQL: Advanced Web Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.