Scenario: An online store has various types of products, including electronics and clothing. Each product has common attributes like name and price, but they also have specific attributes. How would you design the database schema for this scenario?

  • Create separate tables for each product type
  • Implement a superclass-subclass relationship with a product superclass and electronics/clothing subclasses
  • Use a NoSQL database instead of a relational database
  • Use a single table for all products with nullable columns for specific attributes
To design the database schema for this scenario, a superclass-subclass relationship with a product superclass and electronics/clothing subclasses is ideal. This allows common attributes like name and price to be stored in the superclass while specific attributes can be stored in the subclasses. It provides flexibility and scalability in the database design.
Add your answer
Loading...

Leave a comment

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