Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
185 views
in Technique[技术] by (71.8m points)

database - identifying the functional dependencies

I have been reading up on database design and I am having some difficulty constructing functional dependency diagrams from tables.

I have the following table. Each salesperson is identified by a salesperson’s number, and their sales activities are recorded for each month in the table.

http://i.stack.imgur.com/2NXru.png

I have made the following assumptions:

  • Each Salesperson has a unique salesperson number
  • Each Client has a unique client number
  • Each product has a unique product number and description
  • Each Customer has a unique sales persons that they deal with.

I have come up with the following functional dependencies diagram:

http://i.stack.imgur.com/XFndy.png

My questions are:

  • First of all is this correct way of creating a fd diagram?
  • Is this correct based upon the assumptions?
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Functional dependencies aren't usually expressed in a diagram. Instead, they're usually expressed like this . . .

A->B
B->CD

or like this.

"Salesperson number" -> "Salesperson name"
"Client number" -> "Client name"

If your diagram means that "Product number" -> "Quantity sold", then your diagram is wrong. Also, client number does not determine product number.


A functional dependency answers the question, "Given one value for A, can I determine one and only one value for B?", where A and B are sets of attributes. Let's look at a simple example.

Given one value for "Product number", can we determine one and only one value for "Product description"? Yes. Given the product number P1023-01, we can determine only one value for "Product description": "A4 Paper". Product number P1023-01 never matches up with any product name but "A4 Paper".

Given one value for "Product number", can we determine one and only one value for "Quantity sold"? No. Given the product number P1023-01, we can determine two different values for "Quantity sold": 6 and 10. The dependency "Product number" -> "Quantity sold" doesn't hold in this relation.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...