State capitals also have an extra column, state, that shows their state. In this case, the capitals table inherits all the columns of its parent table, cities. We define the capitals table so that it inherits from cities: However, what happens when we want to ask for data about a city, regardless of whether it is a capital or not? The inheritance feature can help to resolve this problem. This can be done by creating two tables, one for state capitals and one for cities that are not capitals. We want to be able to quickly retrieve the capital city for any particular state. Each state has many cities, but only one capital. Let's start with an example: suppose we are trying to build a data model for cities.
(SQL:1999 and later define a type inheritance feature, which differs in many respects from the features described here.) PostgreSQL implements table inheritance, which can be a useful tool for database designers.