4 ms·
> How can you ensure that a school is either a college or high_school but not both? Do you have any real world scenarios where you've faced this problem? In y
by go_prodev 4y ago
> How can you ensure that a school is either a college or high_school but not both?
Do you have any real world scenarios where you've faced this problem?
In your example, you wouldn't model it like that. A school just needs an attribute that identifies the type of school (high school or college), and other attributes that would be common to both.
I'm sure there's lots of examples but it's late and I'm struggling to think of one that a good normalized data model couldn't handle.
- vore 4y agoI'm modeling the GP's comment, but I think a common case is something like a polymorphic user/organization entity like GitHub: there is some kind of base user that is usable in a lot of places (e.g. https://github.com/<username> https://github.com/<username>) but there's also a load of distinct organization-specific fields and a load of distinct user-specific fields.