What are attributes and its types?

This article is based on the attributes in DBMS, the types of attributes in DBMS that exist and how they are used with their real-world implementation using examples. Myriad types of attributes are discussed along with their ER diagrams discussed to clear up what is attribute in DBMS along with their use cases

What is Attribute in DBMS?

Attributes in DBMS are a property of an entity holding essential information relative to the database. An entity is composed of a number of attributes connected to it where it can be assumed that both are interdependent on each other for their functioning as no attributes will strip the entity of its value and there needs to be an entity for the attributes to exist.

Example of Attributes

Taking a real-world example of a school, we can assume the student is one of the many entities reporting there among teachers, management, and other staff. All the students have a set of attributes in common between them. As given in the figure mentioned, Name, Roll Number and Age, in oval, are the types of attributes of the Student entity represented in Green inside the Rectangle box whose relationship is denoted using an arrow. A few of the necessary conditions that the attribute must abide by are

  1. It must have valid alias i.e., attributes in DBMS must be named on assigning it to a particular entity
  2. It should have a fixed range between which the values must lie to be valid.

To comprehend more on what is attribute in DBMS? the name of attributes must follow the naming conventions and should be easy to read and understand by the viewer as well as the administrator, failing to which, there can be confusion and even loss to the owner in the worst-case scenario.
On the other hand, assigning the attribute value to the entity, a check is performed on if the value is lying between the range set up for that very attribute or else it will not assign value to the attribute, ignoring any illegitimate entry.

Applications of Attributes

Applications of attributes in DBMS (database management system) where the columns are divided having particular attributes linked to schema or table and in object-oriented programming, classes where attribute holds the properties of that same class possessing the same principles discussed in this article, What is attribute in DBMS?

There are different types of Attributes for their own benefits and purposes used to attach any type of credential to the entity. The following points have an illustration as well as the description and purpose of attributes to clear doubts leading up to what is attribute in DBMS? and the types of attributes in DBMS?

Types of Attributes in DBMS

In this section, we will be discussing the types of attributes in DBMS that play a major role in distinguishing their values and relationship with the parent entity.

1. Simple Attribute:

In this attribute, the entity and attribute share a simple relationship with each other. The other characteristic of simple value is that the value must be atomic which states that the value should not be broken under any means.

For ex. Take an example of a Car, it has a particular color (red, white or black) and fixed occupancy (four-seater or two-seater). Thus, the values are atomic and share a direct relationship with the entity.

2. Composite Attribute:

This is a special type of attribute that constitute a set of attributes within themselves. The entity has an attribute which is classified into various attributes having one to many relationship among them.

For ex. A Phone Number can be split into two parts where the attributes can be country code and ten-digit phone number. The actual attribute is connected to many sub-attributes, thus, having a one-to-many relationship.

3. Multi-Valued Attribute:

Multi-valued attributes in DBMS are used for an attribute that consists of more than one value. Remember to not confuse composite attributes with multi-valued as composite attributes have a set of attributes, on the other hand, multi-valued attributes. Represented by inscribing an oval within the oval used for the attribute.

For ex. Reiterating the student entity example, the subjects a student has to vary as some students are enrolled in additional subjects while some have only compulsory subjects. The number of subjects is multiple and varies.

4. Derived Attribute:

Attributes in DBMS whose value depends on some other attribute. The value of such attributes is derived from another attribute of the entity.

For ex. The weather situation (warm, cold, rainy) is derived from other attributes like temperature and rainfall in millimetres. In this manner, the weather situation is evaluated and assigned to the attribute.

5. Key Attribute:

Attributes that define the originality of the entity. These attributes are the primary key and can distinguish between the properties of an entity as they are unique. All the values in this kind of attribute must not repeat themselves.

For ex. Govt. ID card number is one of the many types of attributes in DBMS which is unique and often used as a key for daily life purposes. A key attribute is one of the attributes in DBMS that can be a simple attribute as well as a key attribute as in the following example.

6. Single Valued Attribute:

Attributes which can store only one value and not support the inclusion of any further values. These attributes are the opposite of multi-valued attributes as they restrict to a single entry.

For ex. Fields like Total alary require only a single value to be entered unlike phone numbers and emails, which can be multiple such as professional and personal contacts.

7. Complex Attribute

It can be thought of as a combination of composite and multi-valued attributes in DBMS. They can hold a number of sub-attributes within them.

For ex. An address can be assumed as a composite attribute having house number, area and city while phone numbers can be personal or work i.e. multi-valued. Hence, merging these two makes the attribute complex.

8. Stored Attribute:

This attribute helps us in deriving an attribute with the information that it constitutes. It is termed as. a stored attribute as it is stored for the future, deducing the value of the derived attribute.

For Ex. Country/ Place of residence can be derived with the help of a Code that is embedded with a Phone Number, as a result, the country code works as a stored attribute.

Now that we know the answer to the question: What is attribute in DBMS and types of attributes in DBMS? Let’s have a look at how they can be represented.

All the attributes in DBMS and entities can be drawn on paper using predefined rules and notions set in place accordingly for them. Such representations are known as Entity-Relationship Diagrams or ER Diagrams. Rectangle boxes are used to denote the entities while the oval shape is used for the attributes in DBMS.

This brings us to the end, What are attributes and its types?, Hope you have a better understanding of what is attribute in DBMS and types of attributes in DBMS. You can check out more articles on PrepBytes.

Frequently Asked Questions (FAQs) related to attribute in DBMS

1. What is the use of an attribute?
Attributes in DBMS are component used to define the instances in its column which hold any information relative to the entity.

2. How do you write attributes?
Attributes are written as a connectional dependency to the entity as it justifies any form of characteristics of the entity. The oval shape is used to define the attribute while making an ER Diagram.

3.What is the difference between attribute and variable?
Attributes can be any qualitative data that has any characteristics while a variable is a continuous value that can vary with the context it is being scaled.

4.What are tuples and attributes?
Tuples denote a single entity having various attributes attached to it while attributes in DBMS are possessed by every tuple that exists in the schema.

Leave a Reply

Your email address will not be published. Required fields are marked *