开发者

Determining the functional dependencies of a relationship and their normal forms

I'm studying for a database test, and the study guide there are some (many) exercises of normalization of DB, and functional dependence, but the teacher did not make any similar exercise, so I would like someone help me understand this to attack the other 16 problems.

1) Given the following logical schema: Relationship product_sales

POS     Zone     Agent   Product_Code   Qualification   Quantity_Sold
123开发者_如何学Python-A   Zone-1   A-1     P1             8               80
123-A   Zone-1   A-1     P1             3               30
123-A   Zone-1   A-2     P2             3               30
456-B   Zona-1   A-3     P1             2               20
456-B   Zone-1   A-3     P3             5               50
789-C   Zone-2   A-4     P4             2               20

Assuming that: • Points of Sale are grouped into Zone. • Each Point of Sale there are agents. • Each agent operates in a single POS. • Two agents of the same points of sale can not market the same product. • For each product sold by an agent, it is assigned a Qualification depending on the product and the quantity sold.

a) Indicate 4 functional dependencies present.

b) What is the normal form of this structure.


To get you started finding the 4 functional dependencies, think about which attributes depend on another attribute:

eg: does the Zone depend on the POS? (if so, POS -> Zone) or does the POS depend on the Zone? (in which case Zone -> POS).

Four of your five statements tell you something about the dependencies between attributes (or combinations of several attributes).


As for normalisation, there's a (relatively) clear tutorial here. The phrase "the key, the whole key, and nothing but the key" is also a good way to remember the 1st, 2nd and 3rd normal forms.


In your comment, you said

Well, According to the theory I've read I think it may be, but I have many doubts: POS → Zone, {POS, Agent} → Zone, Agent → POS, {Agent, Product_code, Quantity_Sold} → Qualification –

I think that's a good effort.

  1. I think POS->Zone is right.
  2. I don't think {POS, Agent} → Zone is quite right. If you look at the sample data, and you think about it a bit, I think you'll find that Agent->POS, and that Agent->Zone.
  3. I don't think {Agent, Product_code, Quantity_Sold} → Qualification is quite right. The requirement states "For each product sold by an agent, it is assigned a Qualification depending on the product and the quantity sold." The important part of that is "a Qualification depending on the product and the quantity sold". Qualification depends on product and quantity, so {Product_code, Quantity}->Qualification. (Nothing in the requirement suggests to me that the qualification might be different for identical orders from two different agents.)

So based on your comment, I think you have these functional dependencies so far.

  • POS->Zone
  • Agent->POS
  • Agent->Zone
  • Product_code, Quantity->Qualification

But you're missing at least one that has a significant effect on determining keys. Here's the requirement.

Two agents of the same points of sale can not market the same product.

How do you express the functional dependency implied in that requirement?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜