Reputation: 9027
So, what would be the best approach to design relationship in a table when I have this setup:
Let's say I have tblFile that holds file path's to different files. and then I have bundles that can contain any amount of files.
So, my current structure is as follows:
How do I avoid creating tblBundle in this case (Because it doesn't need to contain any additonal information. But I still want it to be a key. And what would be a naming convention for "BundleId" column if I remove 2nd database)
Upvotes: 1
Views: 293
Reputation: 726849
If you do not need the one-column table, you do not have to create it. When the key is surrogate (i.e. have no meaning outside your data model) there is nothing wrong with having a non-primary key that does not reference other tables. You can index the column if you need faster access by BundleId
.
There are advantages to having a table, though: you can make a foreign key with cascading delete, so deleting a row from the bundle table would automatically delete all its children rows.
Upvotes: 2