What Is Single Table Inheritance: Complete Guide with Examples
Learn what Single Table Inheritance is, how it works, its pros and cons, and real-world examples to help you design efficient database schemas.

What Is Single Table Inheritance: Complete Guide with Examples is a critical topic for developers working with object-relational mapping (ORM) frameworks and database design patterns. Single Table Inheritance (STI) is a strategy used to map an entire class hierarchy into a single database table. Instead of creating multiple tables for each subclass, STI consolidates all fields into one table and uses a discriminator column to differentiate between record types.
This approach is widely used in frameworks like Ruby on Rails, Django ORM (with variations), and Hibernate. Understanding STI helps developers optimize performance, simplify schema design, and make informed architectural decisions.
What Is Single Table Inheritance?
Single Table Inheritance (STI) is a database design pattern where multiple related classes are stored in a single table.
The table contains columns for all possible attributes across all subclasses, along with a type (discriminator) column that identifies which subclass each row represents.
Key Characteristics of STI
- One table stores all related entities
- A discriminator column defines the entity type
- Columns may be nullable depending on subclass requirements
- Common fields are shared across all records



