Scenario: A car rental company offers different types of vehicles such as cars, trucks, and vans. How would you implement a superclass-subclass relationship to represent this scenario in a database?

  • Create separate databases for cars, trucks, and vans
  • Create separate tables for each vehicle type
  • Implement a superclass-subclass relationship with a vehicle superclass and car/truck/van subclasses
  • Use a single table for all vehicles with a column specifying the vehicle type
In this scenario, implementing a superclass-subclass relationship with a vehicle superclass and car/truck/van subclasses is the appropriate approach. It allows common attributes to be stored in the superclass while specific attributes for each vehicle type can be stored in the respective subclasses. This ensures data consistency and facilitates efficient querying.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *