Latest Job News

Attributes and Types Of Attributes

 

 

Attributes are characteristics of entities. For example, the STUDENT entity includes, among many others, the attributes STU_LNAME, STU_FNAME, and STU_INITIAL. In the original Chen notation, attributes are represented by ovals and are connected to the entity rectangle with a line. Each oval contains the name of the attribute it represents. In the Crow’s Foot notation, the attributes are written in the attribute box below the entity rectangle.

Attributes

 

Required and Optional Attributes

A required attribute is an attribute that must have a value; in other words, it cannot be left empty. As shown in the above Figure, there are two boldfaced attributes in the Crow’s Foot notation. This indicates that a data entry will be required.

In this example, STU_LNAME and STU_FNAME require data entries because of the assumption that all students have a last name and a first name.

An optional attribute is an attribute that does not require a value; therefore, it can be left empty. For example students might not have a middle name, and perhaps they do not (yet) have a phone number and an e-mail address. Therefore, those attributes are not presented in boldface in the entity box.

 

 

Domains

 

Attributes have a domain. A domain is the set of possible values for a given attribute. The domain for the gender attribute consists of only two possibilities: M or F (or some other equivalent code). The domain for a company’s date of hire attribute consists of all dates that fit in a range (for example, company startup date to current date).

 

Identifiers (Primary Keys)

 

The ERM uses identifiers, that is, one or more attributes that uniquely identify each entity instance. In the relational model, such identifiers are mapped to primary keys (PKs) in tables. Identifiers are underlined in the ERD. Key attributes are also underlined in a frequently used table structure shorthand notation using the format:

 

TABLE NAME (KEY_ATTRIBUTE 1, ATTRIBUTE 2, ATTRIBUTE 3, . . ATTRIBUTE K)

 

For example, a STUDENT entity may be represented by:

 

STUDENT (Student_ID, Student_Name, Class, CGScore)
(Each Student is identified by a unique Student identification number, or Student_ID.)

 

Attributes_types of attributes

 

Composite Identifiers:

 

An entity identifier is composed of only a single attribute. However, it is possible to use a composite identifier, that is, a primary key composed of more than one attribute.

 

For instance, the Tiny College database administrator may decide to identify each CLASS entity instance (occurrence) by using a composite primary key composed of the combination of CRS_CODE and CLASS_SECTION instead of using CLASS_CODE.

 

The CLASS entity may be represented in shorthand form by:

CLASS (CLASS_CODE, CRS_CODE, CLASS_SECTION, CLASS_TIME, ROOM_CODE, PROF_NUM)

 

On the other hand, if CLASS_CODE is deleted, and the composite primary key is the combination of CRS_CODE and CLASS_SECTION, the CLASS entity may be represented by:

CLASS (CRS_CODE, CLASS_SECTION, CLASS_TIME, ROOM_CODE, PROF_NUM)

Note that both key attributes are underlined in the entity notation.

 

Composite and Simple Attributes:

 

Attributes are classified as simple or composite.

A composite attribute, not to be confused with a composite key, is an attribute that can be further subdivided to yield additional attributes. For example, the attribute ADDRESS can be subdivided into street, city, state, and zip code. Similarly, the attribute PHONE_NUMBER can be subdivided into area code and exchange number.

A simple attribute is an attribute that cannot be subdivided. For example, age, sex, and marital status would be classified as simple attributes. To facilitate detailed queries, it is wise to change composite attributes into a series of simple attributes.

Attributes_Composit Attributes

 

Single-Valued Attributes :

 

Single-valued attribute is an attribute that can have only a single value. For example, a person can have only one Social Security number, and a manufactured part can have only one serial number. Keep in mind that a single-valued attribute is not necessarily a simple attribute. For instance, a part’s serial number, such as SE-08-02-189935, is single-valued, but it is a composite attribute because it can be subdivided into the region in which the part was produced (SE), the plant within that region (08), the shift within the plant (02), and the part number (189935).

 

Multi valued Attributes:

 

Multi valued attributes are attributes that can have many values. For instance, a person may have several college degrees, and a household may have several different phones, each with its own number. Similarly, a car’s color may be subdivided into many colors (that is, colors for the roof, body, and trim).
In the Chen ERM, the multi valued attributes are shown by a double line connecting the attribute to the entity.

 

Derived Attributes:

 

A derived attribute is an attribute whose value is calculated (derived) from other attributes. The derived attribute need not be physically stored within the database; instead, it can be derived by using an algorithm. For example, an employee’s age, EMP_AGE, may be found by computing the integer value of the difference between the current date and the EMP_DOB.

Attributes_derived attributes

 

 

You May Also Like:

Basic Notations of ER diagram

Different types of Entities

Degree of relationships

The database design challenges

Find Other DBMS Questions