Nothing Special   »   [go: up one dir, main page]

Attributes and Its Types

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 14

ATTRIBUTES AND ITS TYPES

DR.V.K.SRIVASTAVA
PROFESSOR & HEAD
DEPARTMENT OF COMPUTER SCIENCE &
APPLICATIONS
FACULTY OF MANAGEMENT & COMMERCE
ASTHAL BOHAR, ROHTAK-
124021,HARYANA
INTRODUCTION
Suppose we have a classroom. In this classroom, we have many students then
how do we differentiate one student from another? It is the property of each
student that helps us in doing so. A student can have many properties like his
name, age, height, class, roll no, etc. which will help in identifying each student
distinctly. Yes we are talking about attributes. As we know that there are three
components of E-R Model :
• Entity.
• Relation.
• Attributes.
• Entity: Entity in DBMS can be a real-world object with an existence, For example,
in a College database, the entities can be Professor, Students, Courses.
• Relation: are associations between tables that are created using join statements
to retrieve data.
• Attribute: A real-world property of an entity type is called an attribute.
CONT…
• This is the characteristics of an entity. It is represented by an oval
or ellipse in E-R diagram. Each attribute can take only a set of
permitted values. This is called the domain of that attribute. For
example, we define the roll_no of the ‘Student’ by a numeric
value. So, the permitted values are only integers and hence,
‘integer’ is the domain of attribute ‘roll_no’. Each attribute is
represented by a separate column in a relational table.
For example, The entity ‘Student’ has properties like Name,
Address, Roll_no, Mobile_no, Age, DOB, Class, Section, etc. So,
when we make an E-R diagram then Name, Address, Roll_no,
Mobile_no, Age, DOB, Section and Class are represented as the
attributes of the entity type ‘Student’.
CONT…
There are are many types of attributes which are
as follows:
• Simple Attribute & Composite Attribute
• Single Valued Attribute & Multi-valued
Attribute
• Stored Attribute & Derived Attribute
• Key Attribute & Non-key Attribute
SIMPLE ATTRIBUTE

A simple attribute contains an atomic value


which cannot be further divided. It is simply
represented by an oval. A simple attribute is
directly connected to the entity type. While
making the E-R diagram, we directly connect
the oval with the rectangle.
For example, Roll_no of Student, Age of
Student. It is represented in the E-R diagram
as:
COMPOSITE ATTRIBUTE
• Composite Attribute
• A Composite attribute can be further divided into other attributes. We
represent this in E-R diagram by connecting an oval with oval i.e the
composite attribute is also represented by oval and the further divided
attribute all also represented by ovals. When we convert this E-R diagram to
the relational table then we don't have any column of the composite
attribute. We have column only for the attribute which came after we
further divided the composite attribute.
• For example, Name of a student can be further divided into first name,
middle name and last name. The composite attribute name is also
represented by oval as well as the other attributes are also represented by
oval and we connect the all the further divided attributes with the
composite attribute. In the table, we will have three columns i.e. First_name,
Middle_name, and Last_name. There is no such column called "Name".
FIGURE FOR COMPOSITE ATTRIBUTE
SINGLE VALUED ATTRIBUTE
This attribute has only one value. It is
represented by a simple oval. Some simple
attribute can also be a single-valued attribute.
For example, the Section of ‘Student’ is a simple
attribute as it can’t be further divided. Also, it is
a single-valued attribute because a student
can't study in more than one section.
For example, Section of a Student.
MULTIVALUED ATTRIBUTE
This attribute has more than one value. It is represented
by a double oval. Some Composite keys can also be a
multivalued attribute. For example, the address attribute
of a student can further be divided into ‘Locality’, ‘Town’
and ‘PIN’. So, we call it a composite attribute. Also, the
address of a student can have more than one value. A
Student can have more than one Address i.e Permanent
Address and Temporary Address. So, it can also be called a
multivalued attribute.
For example, A student can have more than one e-mail
address.
STORED ATTRIBUTE
The value of this attribute should be provided
by the user. This attribute is stored and can be
used for finding the value of other attributes.
It cannot be derived from any other attribute.
It is also represented by an oval. For Example,
The Date of Birth of ‘Student’ has to be
provided by the student.
Example: Date of Birth(DOB) of Student.
DERIVED ATTRIBUTE
The value of this attribute is derived from some
other attributes. We know the value of some
other attribute(stored attribute)and from stored
attribute, we are deriving the value of this
attribute(derived attribute). This is done mainly
because the value for such attribute keeps on
changing. It is represented by a dashed oval.
For example, The value of age attribute is
derived from the DOB(date of birth) attribute.
KEY ATTRIBUTE
A key attribute is used to uniquely identify the
entities of an entity type. In a relational table, it
represents the primary key of the table. It is
represented by oval and the text in it is underlined.
Even if all the other attributes of an entity are the
same but the key attribute will always be different.
Example: We have Roll_no as the key attribute of
the ‘Student’ because two students can never has
same roll number.
NON KEY ATTRIBUTE
All the other attributes other than the key
attribute are the non-key attributes. Two or
more entities can have the same value for this
attribute. For example, the Class attribute
would have the same value for all those
students who are studying in the same class.
Example: Class, Section, Age, Name etc, are
the non-key attributes.
THANKS

You might also like