Top Qs
Timeline
Chat
Perspective

Single Table Inheritance

From Wikipedia, the free encyclopedia

Remove ads

Single table inheritance is a way to emulate object-oriented inheritance in a relational database. When mapping from a database table to an object in an object-oriented language, a field in the database identifies what class in the hierarchy the object belongs to.[1] All fields of all the classes are stored in the same table, hence the name "Single Table Inheritance". In Ruby on Rails the field in the table called 'type' identifies the name of the class. In Hibernate (Java) and Entity Framework this pattern is called Table-Per-Class-Hierarchy and Table-Per-Hierarchy (TPH) respectively.,[2][3] and the column containing the class name is called the Discriminator column.

Remove ads

Example

More information BlogId, Discriminator ...

The table have the Url which is used by all blogs but only blogs of type RssBlog have a value assigned in the RssUrl column, other rows have NULL.

See also

References

Loading content...
Loading related searches...

Wikiwand - on

Seamless Wikipedia browsing. On steroids.

Remove ads