Do you think IIT Guwahati certified course can help you in your career?
No
Introduction
You may have heard about managing the relationship diagram in the database management system. Well, if you haven't, don’t worry! We've got you covered. In this article, we will discuss an important attribute used in ER modeling, the composite attribute. We will guide you with every detail you need to know about.
We will discuss the composite attribute along with the representation of the attribute. For this, we will see two important mapping methods the ER diagram mapping and the relational table. So without any further delay, let's get started.
What is Composite Attribute in DBMS?
Composite attribute is one of the types of attributes used in ER modeling. The attributes that cannot be divided into smaller parts are called simple attributes. The composite attribute is just the opposite of the simple attribute. So, the attributes that can be divided into more parts are known as composite attributes. Composite attributes can be used to contain simple attributes.
Example
Let’s take an example to better understand the composite attribute. Consider we have two attributes. One is the student's name, and the other one is the address. We want to divide it into some subparts. For the student name attributes, we can divide it into the student's first name, middle name, and last name.
Just like what we did for student names, we can also do it for addresses. For the address attribute, we can have the Street name, Area name, City, State, and Country. We can also further divide the street name into door number and street name.
In DBMS, a composite attribute is represented by an oval shape that is joined to an oval shape for a simple attribute. Now let's have a look at the mapping methods.
Mapping Methods
In a DBMS, we have many methods for mapping composite attributes. Although, we generally use two types to do the mapping. These two are by ER Diagram and Relational Tables.
Name of the relation = Entity set of ER diagram
Name of the column = Attributes of ER diagram
Entity-Relationship Diagrams (ERDs)
Entity-Relationship Diagrams are a common method for mapping composite attributes in a DBMS. They use graphical symbols to represent the entities, attributes, and relationships between them. Composite attributes are represented by grouping related attributes together and enclosing them in brackets.
For example, we will take a student relation diagram. It will have student and its details. The student will have a student_id and a student name. Apart from it, the details will have branch, email_id and college name.
Student ID
Student Name
Branch
Email ID
College
Above is the ER diagram for the student relation diagram which we discussed. Here, the student is the entity. All the other details such as branch, email id, college, student name, and student_id are its attributes.
In a relational Database, composite attributes can be represented by creating separate columns for each component of the composite attribute. Let’s take the above-discussed example to create the relational table for mapping the composite attribute.
Following table is the relational table for the ER diagram we made above.
Student ID
Student Name
Branch
Email
College
Above is the relational table for the student relation diagram. As we know for a composite attribute mapping, the name of the relation is the entity set of the ER diagram. The name of the columns is the attributes of the ER diagram. We always consider the end nodes of the ER diagram for the column name of the relational table. As you can see, we had not taken details attributes in our relational table. We had taken only the branch, email_id, and college which are the attributes further associated with the details attribute of the student relation diagram.
Composite attributes combine multiple simple attributes into a single attribute. For example, "address" may consist of "street," "city," and "zip code."
What is composite in DBMS?
In DBMS, a composite is a collection of data elements treated as a single unit, like a composite key consisting of multiple attributes.
What is the difference between composite attribute and atomic attribute?
Composite attributes group multiple simple attributes, while atomic attributes are indivisible. For instance, "address" is composite, while "age" is atomic.
How do you identify composite attributes?
Identify composite attributes by recognizing entities requiring sub-components, such as "address" composed of "street," "city," and "zip code."
Conclusion
This article briefly discussed the composite attribute along with the representation of these composite attributes. We also discussed two important mapping methods the ER diagram mapping and the relational table. You can check out our other blog to enhance your knowledge: