Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
Now let’s consider some reasonably realistic examples of relvars with more than one key. The first concerns a relvar EXAM, with attributes S (student), J (subject), and P (position), and predicate Student S was examined in subject J and achieved position P in the class list. For the sake of the example, let’s assume there are no ties (that is, no two students obtained the same position in the same subject). Then, clearly, given a student and subject, there’s exactly one corresponding position; equally, given a subject and position, there’s exactly one corresponding student. So the FDs {S,J} ? {P} and {J,P} ? {S} both hold, and {S,J} and {J,P} are both keys (or candidate keys, if you prefer):
EXAM { S , J , P }
KEY { S , J }
KEY { J , P }