Hi I need be able to link related applications and am trying to work out the best practice table structure for saving, updating and deleting.
I have the following table:
APPLICATION{ApplicationId, Name, Description}
I need to be able to say Application 1 is linked to 2 and 3. Therefore if you open application 2 you’d see that it is linked to application 1 and 3. Then application 3 is linked to 1 and 2.
What is the best table structure for a linked table?
EDIT
My main query is will I need a record for each join ie for applications 1, 2 and 3 would I need 6 records? 1->2, 1->3, 2->1, 2->3, 3->1, 3->2 ?? If not what is the best query to return all linked apps for a given id?
use relationship_type to specify how the applications are related, and use the dates to specify when that relationship was valid
edit:
maybe there is a collective misinterpretation of your use of the word ‘linked’.
If you instead mean ‘grouped’ then you might consider a structure like the following:
here you can just place applications into the same ‘group’ and then query them all back when they are in the same group.