sql - Single Bridge Table or is there a better way? -


I am trying to find an answer for this and I do not know the best way to describe it.

Actually, I have 3 source tables with unique identifier keys. We call these tables Skill 1, Duty 2, Custom 3. They are connected to each other separately from this fact (not easily) that they are the qualities of a particular job. I want to tie resources with these skills (eg: a book, a URL, a course ID), now 8 different tables, which I will call resource 1 - resource 8. This is to allow the addition of any combination of these types of resources for any of the features included in 3 "skill tables".

I came up with many weird designs, but I did the following:

Table - Column -> FK

  Skill 1 - Skilldiscimal ID - & gt; BridgeTable AttitudeUniquid Duty 2 - DutyUNIID - & gt; BridgeTable SpecialtyAnyID Custom 3 - Customized - & gt; Bridgetable. Unbreakable Univined BridgeTable - Attribute UNIID, ResourceAnIIID, Attribute Type, ResourceTip Resource 1 - ResourceAnyID - & gt; BridgeTable ResourceUnIID Resource 2 - ResourceAnyid - & gt; BridgeTable ResourceUnIID Resource 3 - ResourceUnited - & gt; BridgeTable ResourceUnneind ... etc. "The problem" with this simple design is that I have a bridge table in 8 resource tables to add a "toothbrush" tables and I have to use attribute type and resource type in logic in the stored processes. (And possibly application to use these tables) so that the tables can be used.  

Is there any better way to add these 3 specialty tables to resources without repeating the data that already exists? (I.e.: creating a "job" table with all possible combinations of properties, or mashing all of your processing table with several tapable columns in a table)

Depending on what you described in the third general form database, you will need a bridge table that connects each attribute and each potential resource table. Any type of shortcut (as you've proposed) leads to problems (such as what you've found - a good article can be found on this topic, or perhaps Google on "MUCK tables").

The data in 8 resource tables can be modified in one table, something like this:

  resourcesNiiiIiIID resource processing type resource processing ATC  

Probably defined a "type of resources To help control / write the "type" table? If so, then you will only need a pull table for each attribute table.

Alternatively, one of the type-subtype tables Set - Top-level resource table, will help you to obtain the current table is configured as a sub-type.

If you do not accept this, controlled denormalization can help all those single tables Make a combination of resources, and then copy the data from each resource. Of course, the cost of denunciation is that when (if not) the resources are updated then you have to make them synchronous in many places, and if the update If it is consistent then it can be a royal nightmare.

Finally, if you have complex data, then you will need complex models and codes so that they can properly represent it. Denormaliztion can take shortcuts, but it appears that they are shortcut and will need additional care, support and maintenance over time. The best advice I have heard on this subject is to produce fully and properly normalized layout, and then only introduce controlled denormalizations to support their goals.


Comments

Popular posts from this blog

Eclipse CDT variable colors in editor -

AJAX doesn't send POST query -

wpf - Custom Message Box Advice -