In this example I have a table called "Zones"
create table stk_zones (
ZoneId int not null auto_increment,
Primary Key (ZoneId),
ZoneName varchar(255),
Height int,
Width int,
Description varchar(255)
);
Inside this zones table I add a few records:
insert into stk_zones (ZoneName, Height, Width, Description)
values ('Zone A', 100, 200, 'First Zone!'), ('Zone B', 50, 50, 'Second Zone!'), ('Zone C', 50, 100, 'Third Zone!');
What would be the best way to show that Zone B is nested inside of Zone A? They share the same properties so I want to keep them in the same table.
Would the best option be a secondary table, something like:
create table stk_zone_relations (
ZoneRelationId int not null auto_increment,
Primary Key (ZoneRelationId),
ParentZoneId int,
Foreign Key (ParentZoneId) references stk_zones (ZoneId),
ChildZoneId int,
Foreign Key (ChildZoneId) references stk_zones (ZoneId)
);
Not sure proper principals in this sort of scenario.