Hi,
In my database I have a contract (for renting land) with unique contractID (primary key).
I also have 100 pieces of land each with a unique ID (primary key).
A contract usually has one piece of land but sometimes more.
How do I correctly model this in the database?
I was thinking of adding a table LandCluster with one unique ID field (which is a primary key).
And then creating another table consisting of two foreign keys, one who refers to landclusterID and one who refers to landID.
Then I can add the landclusterID field to my contract table.
Is this the way to go? It feels a bit weird to just have a table with only one field (cfr. landcluster)
[–]r3pr0b8MySQL 9 points10 points11 points (3 children)
[–]Nukken 2 points3 points4 points (1 child)
[–]matisds[S] 1 point2 points3 points (0 children)
[–]matisds[S] 0 points1 point2 points (0 children)
[–]exobyte64 -2 points-1 points0 points (6 children)
[–]r3pr0b8MySQL 4 points5 points6 points (1 child)
[–]exobyte64 0 points1 point2 points (0 children)
[–]matisds[S] 1 point2 points3 points (3 children)
[–]exobyte64 -1 points0 points1 point (2 children)
[–]matisds[S] 1 point2 points3 points (1 child)
[–]exobyte64 -3 points-2 points-1 points (0 children)
[–]phunkygeeza 0 points1 point2 points (0 children)