1

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:

enter image description here

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)

asked Aug 27, 2016 at 1:37

1 Answer 1

2

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.

answered Aug 27, 2016 at 1:48
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.