quan hệ ngôi n- những ứng dụng
Q U A N H Ệ N - N G ÔI V À N HỮ N G Ứ NG DỤ N ...
Q U A N H Ệ N - N G ÔI V À N HỮ N G Ứ NG DỤ N G

An n-ary relation on sets A1,A2,...,An can be regarded as a function R from
A1 ×A2 ×···×An to the Boolean domain {TRUE, FALSE}, where (a1,a2,...,an) R if and only if R(a1,a2,...,an) = TRUE.
















1. Let A1 be the set of all men and A2 the set of all women, in a nonpolygamous society. Let mRw mean that m and w are presently married. Then each of A1 and A2 is a primary key.
2. Let A1 be the set of all telephone numbers and A2 the set of all persons. Let nRp mean that telephone number n belongs to person p. Then A1 is a primary key if each number is assigned to at most one person, and A2 is a primary key if each person has at most one phone number.
3. In a conventional telephone directory, the name and address domains can form a composite key, unless there are two persons with the same name (no distinguishing middle initial or suffix such as “Jr.”) at the same address.
4. Let A = B = C = Z, and let R be the relation on A×B ×C such that (a, b, c) ∈ R if
and only if a + b = c. The set A × B is a composite key. There is no primary key.
5. Let A = all students at a certain college, B = all student ID numbers being used at the college, C = all major programs at the college. Suppose a relation R is defined on A × B × C by the rule (a, b, c) ∈ R means student a with ID number b has major c.If each student has exactly one major and if there is a one-to-one correspondence between students and ID numbers, then A and B are each primary keys.
6. Let A = all employee names at a certain corporation, B = all Social Security numbers, C = all departments, D = all jobtitles, E = all salary amounts, and F = all calendar dates. On A × B × C × D × E × F × F let R be the relation such that (a, b, c, d, e, f, g) ∈ R means employee named a with Social Security number b works in department c, has jobtitle d, earns an annual salary e, was hired on date f, and had the most recent performance review on date g. The projection P1,5 (projection onto A×E) gives a list of employees and their salaries.