8.5. Object-Oriented SQL

Modern object-oriented features are not just a trendy thing; object orientation can be an important help when implementing huge and sophisticated applications. With the help of object orientation, it is possible to use the same functions and attributes in more than just one object by using inheritance. Inheritance means that a child class can inherit attributes from a parent class. Just like PHP, PostgreSQL supports inheritance and that's what this section covers.

8.5.1. Inheritance and Tables

Tables can easily inherit attributes from each other. In tables, attributes are columns. Take a look at an example:

phpbook=# CREATE TABLE person (name text, birthday date);
CREATE

The table called person contains two columns. ...

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

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.