Table of contents
1.
Introduction
2.
What is Composite Attribute in DBMS?
2.1.
Example
3.
Representation of Composite Attribute
4.
Mapping Methods
4.1.
Entity-Relationship Diagrams (ERDs)
4.2.
Relational Tables
5.
Frequently Asked Questions
5.1.
What is composite attributes with example?
5.2.
What is composite in DBMS?
5.3.
What is the difference between composite attribute and atomic attribute?
5.4.
How do you identify composite attributes?
6.
Conclusion
Last Updated: Mar 27, 2024
Easy

Composite Attribute in DBMS

Author Deleted User
0 upvote
Career growth poll
Do you think IIT Guwahati certified course can help you in your career?

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.

composite attribute

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.

What is Composite Attribute in DBMS

Similar article - Attributes in DBMS

Representation of Composite Attribute

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.

You can also read - Mapping ER to Relational Model

Relational Tables

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.

Must Recommended Topic, Entity Relationship Diagram

Frequently Asked Questions

What is composite attributes with example?

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:

You can refer to our guided paths on the Coding Ninjas Studio platform. You can check our course to learn more about DSADBMSCompetitive ProgrammingPythonJavaJavaScript, etc.

We hope this blog helped you understand the composite attribute in brief. To practice and improve yourself in the interview, you can also check out Top 100 SQL problemsInterview experienceCoding interview questions, and the Ultimate guide path for interviews.

Happy Learning!!

Live masterclass