An important constraint on the entities of an entity type is the key or uniqueness constraint on attributes. An entity usually has an attribute whose values are distinct for each individual entity in the entity set. Such an attribute is called a key attribute, and its values can be used to identify each entity uniquely. In diagrammatic notations each key attribute is represented by underlined attribute inside the oval. For example in the following figure name is the key attribute of the company.
SQL DataBase.......
Monday 18 March 2013
Stored and derived attributes
Stored attributes:
The stored attribute are such attributes which are already stored in the database and from which the value of another attribute is derived is called stored attribute. For example age of a person can be calculated from person’s date of birth and present date. Difference between these two dates gives the value of age. In this case, date of birth is a stored attribute and age of the person is the derived attribute
Derived attributes:
The derived attributes are such attributes for which the value is derived or calculated from stored attributes. For example date of birth of an employee is the stored attribute but the age is the derived attributed. Derived attributes are usually created by a formula or by a summary operation on other attributes. Take another example, if we have to calculate the interest on some principal amount for a given time, and for a particular rate of interest, we can simply use the interest formula
Interest=(N*P*R)/100;
In this case, interest is the derived attribute whereas principal amount (P), time (N) and rate of interest(R) are all stored attributes.
Single valued and multi valued attributes
Single Valued attribute:
Attributes that can have single value at a particular instance of time are called single valued. A person can’t have more than one age value. Therefore, age of a person is a single-values attribute.
Multi valued attributes:
A multi-valued attribute can have more than one value at one time. For example, degree of a person is a multi-valued attribute since a person can have more than one degree. Where appropriate, upper and lower bounds may be placed on the number of values in a multi-valued attribute For example, a bank may limit the number of addresses recorded for a single customer to two. Such attributes are represented by double ovals in ER diagram.
Simple and composite attributes
Composite attributes:
Composite attributes can be divided into smaller subparts. These subparts represent the basic attributes with independent meanings of their own. For example, take Name attributes. We can divide it into sub-parts like First_name, Middle_name, and Last_name.
Simple Attributes:
Attributes that can’t be divided into subparts are called Simple or Atomic attributes. For example, Employee Number is a simple attribute. Age of a person is a simple attribute.Types of Attributes
Attributes are of the following types:-
- Simple and composite attributes
- Single value and multi value attributes
- Stored and derived attributes
Attribute
Definition: - Attributes are the property of entity which describes to the entity. Each entity has attributes. The graphical representation of attribute is an oval. A particular entity will have a value for each of its attributes. For example an employee entity may be described by the employee’s name, age, sex, address, salary, and job.
In the above figure the name is the attribute of entity person and population is the attribute of Entity city.
In the above figure the name is the attribute of entity person and population is the attribute of Entity city.
Subscribe to:
Posts (Atom)