Writing the functional dependency

帅比萌擦擦* 提交于 2019-12-12 06:48:39

问题


First module is User module. Administrators, students, lecturers or guests are users who benefit from the system and they take part in this module. Administrator will assign role as student or lecturer for each user. Each role has different privileges that is lecturer can upload the assignment and course materials, create the online quiz and single upload file. Users have information such as user ID, date of registration, date of latest logon, login account, password, first name, last name, and others details needed. Just say that student ID and lecturer ID cannot be the primary key. Therefore, how am I suppose to state that assignment or quiz ID is functionally dependent on lecturer when assignment ID and my quiz ID is a primary key? Based on my functional dependency, I'm not really sure how am I suppose to relate them to functional dependency?

Entity: User
User(user ID, student ID,  lecturer ID, guest ID, course ID, assignment ID, quiz ID, file upload, date of registration, date of latest logon, login account, password, first name, last name, e-mail, birthdate)

Functional dependency
user ID -> {student ID, lecturer ID, guest ID, date of registration, date of latest logon, login account, password, first name, last name, e-mail, birthdate}
lecturer ID -> {course ID, assignment ID, quiz ID, file upload}

Full dependency
user ID, lecturer ID -> {student ID, guest ID, course ID, assignment ID, quiz ID, file upload, date of registration, date of latest logon, login account, password, first name, last name, e-mail, birthdate}

回答1:


First, a functional dependency in the form A->B means that, given one value for A, we can determine one and only one value for B. Both A and B represent sets of columns. (That's why they're written in uppercase letters.)

Keys really have nothing to do with how you state a functional dependency.

If "lecturer id" functionally determines "assignment id" then the FD is "lecturer id"->"assignment id". If "lecturer id" also functionally determines "quiz id", then another FD is "lecturer id"->"quiz id".

If you want to write that more compactly, you can state the two FDs like this.

"lecturer id"->{"assignment id", "quiz id"}

If you assign the letters L, A, and Q, you can state the two FDs like this.

L->AQ

Braces are usually omitted in this notation, because everyone knows they're supposed to be there.

I'm not sure what you're trying to get at with your last section. But in it, the section labelled "Functional Dependency" doesn't express any dependencies; "Full dependency" doesn't express full dependencies, but might express some partial dependencies; "Partial dependencies" doesn't express any partial dependencies; "Transitive dependencies" doesn't express any transitive dependencies.




回答2:


It is not clear what you are trying to accomplish. And you don't seem to understand the steps that we go through in schema design.

First we determine what application relationships we are interested in. Eg "user [userID] has role lecturer" or "user [user ID] has first name [first name] and password [password] and ...". Each gets a base relation that holds the rows of values that are related that way.

For each relation the meaning of its application relationship determines for every column what sets of columns it is functionally dependent on. Then we find a minimal cover for that. This determines candidate keys. We can pick one candidate key as primary key.

This determines full and partial dependencies of non-prime columns on each candidate key. This allows us to normalize to 2NF by decomposing our relation to separate the non-prime column partial functional depencies on candidate keys into separate relations.

Just say that student ID and lecturer ID cannot be the primary key. Therefore, how am I suppose to state that assignment or quiz ID is functionally dependent on lecturer when assignment ID and my quiz ID is a primary key?

This doesn't make sense. We can't determine the candidate keys until we determine all the functional dependencies. Also: Do you mean {studentID,lecturerID} "can't be the primary key", or do you mean {student ID} "can't" and {lecturer ID} "can't"? Also: What do you mean by "can't"?

We say assignmentID and quizID are functionally dependent on lecturerID in some relation by:

 {lecturer ID} -> {assignment ID}
 {lecturer ID} -> {quiz ID}

We can combine right hand sides (determined column sets) with the same left hand side set (determiner):

{lecturer ID} -> {assignment ID, quiz ID}

But there other rules like that for finding a minimal cover.

Based on my functional dependency, I'm not really sure how am I suppose to relate them to functional dependency?

This doesn't make sense. Relate what to your functional dependencies?

If the only functional dependencies for "User" are the ones in the transitive closure of "Functional dependencies" (ie the only FDs are the ones that must be there when those ones are) then a minimal cover is

{user ID} -> {student ID,  lecturer ID, guest ID, course ID, assignment ID, quiz ID, file upload, date of registration, date of latest logon, login account, password, first name, last name, e-mail, birthdate}

and the only candidate key is

{user ID}

and there are no non-prime column partial dependencies on a candidate key.



来源:https://stackoverflow.com/questions/26780608/writing-the-functional-dependency

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!