Thursday, July 2, 2015

Types of attributes



An attribute can be of the following types:


  • Simple and Composite attributes: Simple attributes are those as the name implies that is they are not divided into subparts. For example, the attribute student_id for the entity student has no subparts and therefore, is a simple attribute. On the other hand, an attribute name can be structured as a composite attribute consisting of first_name, middle_name and last name. As another example, the attribute customer_street for the entity customer can be composite consisting of street_number, street_name and apartment_number.


  • Single-valued and mutivalued attributes: The loan_number attribute for a specific loan refers to one loan_number. Such attributes are said to be single valued. On the other hand there may be instances where an attribute has a set of values for a specific entity. For example, consider the employee entity set with the attribute phone number. An employee may have zero, one or several phone_numbers and different employees may have different phone numbers. This type of attribute is said to be multi-valued. As another example, the attribute dependent name of the employee entity set would be multi-valued, since any particular employee may have zero, one or more dependent(s).

           Upper and lower bounds may be placed on the values in a multi-valued attribute as   
           needed.  For instance, a bank may limit storing the number of phone_numbers for 
           a customer to two. Placing bounds in this way means that the phone_number
           attribute for the customer entity set may have the range 0<=phone_number<=2.


  • ·        Null attributes: An attribute takes a null value when that value is missing, not applicable or unknown. For example a person may have no middle name (not applicable). If the name for a particular customer is null we assume that the value is missing since every customer must have a name. A null value for an apartment_number could mean the address does not include an apartment number (not applicable), that an apartment number exists but we do not know what it is (missing), or that we don’t know whether an apartment number is part of the customer’s address (unknown).


  • ·         Derived attributes: The value for this type of attribute can be derived from the values of other related attributes or entities. For example, a customer entity has the attribute customer_age. If the customer attribute also has an attribute date_of_birth, we can calculate his age from date_of_birth and the current date. Therfore, customer_age is a derived attribute. As another example, the entity employee can have employment_length as an attribute. If this entity has another attribute start_date of his employment, then we can calculate the employee’s employment_length from the start_date and current_date. Hence, in this case employment_length is a derived attribute.
Copyright @ by Rosina S Khan


No comments:

Post a Comment