What is the best database schema to support values that are only appropriate to specific rows?

前端 未结 5 1433
南旧
南旧 2020-11-29 07:43

I have a db table called Calendar with fields

  1. Id (PK)
  2. Name
  3. Description
  4. CalendarTypeId (FK into CalendarType
5条回答
  •  挽巷
    挽巷 (楼主)
    2020-11-29 08:10

    You can use the Single Table Inheritance Pattern, which is close to your suggestion,

    http://martinfowler.com/eaaCatalog/singleTableInheritance.html

    or

    http://martinfowler.com/eaaCatalog/classTableInheritance.html

    if you want to specialize some tables to match the types (Calendar and CalendarType2) you are trying to represent in your database

提交回复
热议问题