Attributes in DBMS
What is Attribute?
An attribute is an element in the database management system that describes the property or certain characteristics of the database entity. It is a crucial element of the database as it provides information about the entity of the databases.
In a relational database management system, the data is represented in tables. We can describe these tables as electronic spreadsheets consisting of various rows and columns.
The entity's attribute is represented in the corresponding column of the table. It describes the value corresponding to the category mentioned in the column. The row of the relational table is called a tuple. A tuple represents the entire data of a single entity. Attributes are the characteristics stored in the tuple that distinguish between the different entities by specifying the value of the characteristic that is unique to it.
An attribute is any non-null cell of a column and is allowed to contain only a single type of value in the column. For example, in the case of a bill, the attributes can be the list of objects, their respective prices, the date of purchase. It is impossible to store a date as an attribute in the price column.
Types of Attributes
Various attributes can be used to describe the property of the entity in the relational database. These are:
- Single-Valued Attribute
- Composite Attribute
- Multivalued Attribute
- Primary Attribute
- Derived Attribute
Single-valued Attribute: As the name itself suggests, these are the most basic type of attributes that can have only value to it for an entity. For example, the First name is an attribute that will only have value.
Composite Attribute: These attributes consist of multiple single-valued attributes. For example, a Name is a composite attribute formed by combining three attributes. These attributes are First Name, Middle Name, and Last Name.
Multivalued Attribute: These attributes allow the user to store multiple different values under the same category for a single entity. For example, Phone Number, a single entity can have multiple phone numbers.
Primary Attribute or Key Attribute: The value stored under this attribute helps the user uniquely identify each entity present in the table. For example, the list of students for the college can have the student's admission number as the key attribute for the table. The table with only one primary attribute is regarded as a strong entity. In contrast, it is possible to have more than one key attribute in the table. For example, if that table has both registration number and admission number as an attribute. Both these attributes are the key attribute of the table.
- Derived Attribute: These attributes can be determined using the other attribute of the entity. The user can derive them by applying certain fixed steps or formulas to certain identity attributes. For example, the age of a person can be represented as the attribute of that person, but at the same time, we can easily determine the age if we know the Date of Birth of the entity. In the case of the bill, we can determine the VAT applied to the product if we know the marked price of the product and the final price of the product.