Database Reference
In-Depth Information
dentName and StudentPhone would change, but the instance would still refer to
the same student. Again, after the changes, a unique set of values for the attrib-
utes describes the student Mary Pearson. It is important to note that values of the
attributes for an object instance may change, but the instance itself remains the
same.
Null Values Suppose the object STUDENT has another attribute, StudentFax.
What about the values of this attribute for the various object instances? If Mary
Pearson has a fax machine, then that fax number will be the value for StudentFax
for her.
On the other hand, if Rob Smith does not have a fax machine, then what about
the value for StudentFax for Rob Smith? We then say that the attribute StudentFax
for Rob Smith has a null value. If an object instance has no value for one of its
attributes, then this attribute has a null value for that instance. Null values are not
blanks or spaces. Null value for an attribute in an object instance indicates the
absence of a value for that attribute in that instance.
Null values for attributes play a significant role in databases. The value of an
attribute for a particular instance of an object may be set to null if a value is not
available, is missing, or is genuinely absent. In a database, as you will see later, null
values may not be permitted for certain attributes. Using appropriate language com-
mands, you can check for null values in attributes for object instances.
Attribute Domains
Let us now consider the example of a different object and its
possible attributes.
Object:
EMPLOYEE
Attributes:
EmployeeID, SocSecNo, EmpName, EmpZip, Salary, HireDate
Examine the values of each of these attributes. You will note that the values for
a particular attribute are from a definite set of values. For example, the values of
EmployeeID may be any number with six digits. That means that the set of values
from which the value of EmployeeID for a particular instance of the object
EMPLOYEE is derived is the set of numbers from 000000 to 999999. This is the
domain of values for the attribute EmployeeID.
The domain of an attribute is, therefore, the set of legal or allowable values for
that attribute. In the case of EmployeeID, the attribute domain is the set of numbers
from 000000 to 999999. Attribute domains are sets based on natural limitations as
for numbers or characters of the alphabet. Mostly, business rules determine attribute
domains.
Each attribute has its own domain for its values. Here are some examples of
domains for the above attributes:
EmployeeID
Set of numbers from 000000 to 999999
SocSecNo
Set of legal 9-digit Social Security Numbers
EmpName
Any text up to 45 characters
EmpZip
Set of legal zip codes
Search WWH ::




Custom Search