Product
、ProductType
、 と呼ばれる 3 つのエンティティがありProductCategory
ます。
、、の 3ProductType
種類があるとしましょう。Book
Music
Video
ProductCategory
、、、の3 つの異なるものがありBook
ます。Fiction
Novel
Technical
、、、ProductCategory
の3Music
つRock
の異なるJazz
Pop
そして、3 つProductCategory
の異なる for Video
: Fiction
, Comic
, がありDrama
ます。
AProduct
には aProductType
があり、多くProductCategory
の 's を持つことができます。しかし、そのProductCategory
は と一致する必要がありProductType
ます。たとえば、 が の場合、ProductType
、、およびasBook
のみを使用できます。Fiction
Novel
Technical
ProductCategory
アプリケーションコードやトリガーなどを使用せずに、この制限でこのスキーマをモデル化することは可能ですか (つまり、ProductCategory
aProduct
はその と一致する必要がありProductType
ます)。テーブル、外部キーなどを使用するだけです。
これをどのようにモデル化しますか?