Chapter 1-2-3
|
NAME | DEPT | RANK | OFFICE | SALARY | SUPERVISOR |
---|---|---|---|---|---|
Rao | Electrical Engineering | Professor | KH252 | 50,000 | Jones |
Kaplan | Computer Science | Researcher | ST125 | 35,000 | Brown |
Brown | Computer Science | Professor | ST257 | 55,000 | Black |
Jones | Electrical Engineering | Chair | KH143 | 45,000 | Black |
Black | Administration | Dean | ST101 | 60,000 | NULL |
The relation instance of EMPLOYEE changes with the arrival of new employees, changes to data for existing employees, and with their departure. The relation scheme, however, remains fixed. The NULL value in place of Blacks supervisor signifies that Blacks supervisor has not been defined.
Primary Key
A candidate key for a relation is a minimal set of attributes on which all other attributes depend functionally. In other words, two tuples may not have the same values of the candidate key in a relation instance. A candidate key is minimal no attribute can be discarded without destroying this property. A candidate key always exists, because, in the extreme case, it consists of all the attributes.
In general, there can be more than one candidate key for a relation. If, for example in the EMPLOYEE previously described, duplicate names can never occur, NAME is a candidate key. If there are no shared offices, OFFICE is another candidate key. In the particular relation instance above there are no duplicate salary values. This, however, does not mean that salary is a candidate key. Identification of the candidate key is a property of the relation scheme and applies to every possible instance, not merely to the one that happens to exist at a given moment. SALARY would qualify as a candidate key only in the unlikely event that the organization forbids duplicate salaries.
The primary key of a relation is one of its candidate keys that has been designated as such. In the previous example, NAME is probably more appropriate than OFFICE as the primary key. Realistically, a truly unique identifier, such as social security number or employee identity number, rather than NAME should be used as the primary key.
Previous | Table of Contents | Next |
We are proud to bring to all of our members a legal copy of this outstanding book. Of course this version is getting a bit old and may not contain all of the info that the latest version are covering, however it is one of the best tool you have to review the basics of security. Investing in the latest version would help you out in your studies and also show your appreciation to Auerbach for letting me use their book on the site.