Recursive Relationship Customer 1 comprises A customer comprises zero or more customers © Ron McFadyen
Hierarchies Customer1 is hierarchically structured. Any of these customers are ones you may deal with. Each of these appears in the customer dimension. Customer 1 Customer 2 Customer 7 Customer 3 Customer 4 Customer 8 Customer 5 Customer 6 © Ron McFadyen
Hierarchies The valid paths are: Customer 1 Customer 2 Customer 7 © Ron McFadyen
Consider the helper/bridge table Customer bridge Parent customer key Subsidiary customer key Levels from parent Level name Bottom flag Top flag Some useful additional attributes Levels from parent Level name Bottom flag Top flag And we’ll add one extra row for each node paired with itself © Ron McFadyen
Subsidiary customer key Levels from parent Level name Bottom flag Bridge table Customer bridge Parent customer key Subsidiary customer key Levels from parent Level name Bottom flag Top flag And we’ll add one extra row for each node paired with itself How many rows will there be? © Ron McFadyen