问题
How do I determine the functional dependency and the candidate key based on this case study?
Course module and it can be performed by lecturer, student or visitor user. Course module consist of subject code and subject name. When admin creates course, it will store course ID, subject code, lecturer ID, course name, and .....
Students are required to enroll in the course and the course enrollment consist of registration ID, student information, date of enrollment, date of completion and....
Based on my assumption, Course ID -> {subject code, subject name}
but on the same time
Admin ID -> (Course ID, subject code, lecturer ID, course name, course description, course category)
Is this somehow correct since I would be required to write another functional dependency on admin module?
回答1:
First we determine what application relationships we are interested in. Eg "user [user ID] 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. The parameters of a relation's application relationship are its attributes. Eg Lecturer(user ID) or User(user ID, first name, password, ...).
For each relation the meaning of its application relationship determines for every column what sets of columns it is functionally dependent on. Eg: Given user [user ID] has first name [first name] and password [password] and ..., if you know user ID then do you know first name? If so there is FD {user ID} -> {first name}. If you know user ID and password do you know first name? And so on for every relation and every set of (possibly determining) attributes and every (possibly determined) attribute.
Then we find a minimal cover for that. This determines candidate keys.
So if you want some feedback on these steps, do them.
来源:https://stackoverflow.com/questions/26796963/finding-functional-dependency