BCA / B.Tech 7 min read

Generalization & Inheritance

What is Generalization & Inheritance in RDBMS:

Generalization is a bottom-up approach in data modeling where common attributes of two or more entities are combined to form a new, higher-level entity (a superclass). For example, `Car` and `Truck` entities both have attributes like `VIN` and `Model`. We can generalize them into a `Vehicle` superclass that contains these common attributes. `Car` and `Truck` would then become subclasses.

Inheritance is the result of generalization. It is a concept where subclasses inherit attributes and relationships from a superclass. For example, the `Car` and `Truck` subclasses inherit the `VIN` and `Model` attributes from the `Vehicle` superclass, while also having their own specific attributes (e.g., `numberOfDoors` for Car, `cargoCapacity` for Truck). This creates an "is-a" relationship (a Car "is-a" Vehicle).