I am trying to create a chained inheritance situation in my application architecture. I want to have various location groupings, from as large as a country down to as small as a single address, country>region>state>city>address, as well as arbitrary groupings like "blue group" and "vip locations".
You can see an example table that I just whipped up to represent possible entities
So Broadway Ave in NYC in New York in Northeast in USA inherit it's color of "#8b0000" all the way from the USA great-grandparent location, but would use it's own cover photo of "macys.png". British columbia would get it's color and photo from it's parent location of Canada. Etc.
Generally my goals are:
- Every location can have it's own data or nulls.
- Inherit traits down the line (e.g. Paris can inherit it's color from france if it doesn't have it's own)
- Arbitrary groupings that users can create ("blue group", "underperformers")
This is just my first pass approach.
Is SQL even right for this kind of inheritance? For example, it seems unlikely that I can select
data very easily from ancestors in the same table with sql, in this chained inheritance manner.
What would be better ways to go about this?