Home
Forums
New posts
Search forums
What's new
New posts
New resources
New profile posts
Latest activity
Resources
Latest reviews
Search resources
Members
Current visitors
New profile posts
Search profile posts
DMCA Policy
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
FEEL FREE TO SHARE TUTORIALS, YOUR SKILS & KNOWLEDGE ON CODING, SCRIPTS, THEMES, PLUGINS OR ANY RESOURCES YOU HAVE WITH THE COMMUNITY-
Click Here To Post Your Request,
JOIN COMPUTER REPAIR FORUM
Home
Forums
DATABASE CODING
SQL
How to diffrientiate between Entity and Attribute
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="Code55" data-source="post: 28" data-attributes="member: 14"><p>In this article, we will have a look at the difference between Entity and Attribute, which form the core principles of the Entity-Relationship Model in Database Management System. We will look at the description of each in detail with examples and compare them for a clear idea.</p><p></p><h3>Entity</h3><p></p><p>An Entity is defined as any object which has a real-time existence. Moreover, an object is only considered as an Entity if it is easily identifiable among all other objects. In the context of DBMS an entity typically represents data in an <a href="https://www.thecrazyprogrammer.com/2017/03/difference-between-dbms-and-rdbms.html" target="_blank">RDBMS</a>. It is an object about which we store or retrieve data from the database. Now, the entities that share the same set of properties coalesce into an <strong>Entity Set</strong>.</p><p></p><p>We represent an entity set as a relation or a table in Relational Database Management System. So, Each row in a table represents an entity and the table itself represents an entity set. Therefore, to maintain integrity and avoid ambiguity, it is essential that all entities (rows) are unique and must not be replicas of each other.</p><p></p><h4>Entity Types</h4><p></p><p>There are in general two types of entities:</p><p></p><ul> <li data-xf-list-type="ul"><strong>Strong Entity: </strong>A Strong Entity is an entity that does not depend on another entity. In the context of RDBMS, a Strong Entity contains the Primary Key of the Table. In ER Model we represent a Strong Entity via a Rectangular box.</li> </ul><p></p><p><img src="https://www.thecrazyprogrammer.com/wp-content/uploads/2021/09/Screenshot-213.png" alt="" class="fr-fic fr-dii fr-draggable " style="" /></p><p></p><ul> <li data-xf-list-type="ul"><strong>Weak Entity: </strong>A Weak Entity is one that always depends on another entity or parent entity. Hence, it has no Primary Key to uniquely identify it in the table. A doubly rectangular box usually represents a Weak Entity in ER Model.</li> </ul><p></p><p><img src="https://www.thecrazyprogrammer.com/wp-content/uploads/2021/09/Screenshot-218.png" alt="" class="fr-fic fr-dii fr-draggable " style="" /></p><p></p><p>Now, let us understand the above-discussed points with some examples.</p><p></p><p>Suppose we have a table Student which contains the following records:</p><p></p><table style='width: 100%'><tr><td><strong>STUDENT</strong></td><td><strong>ROLL</strong></td><td><strong>STUDENT</strong></td><td><strong>ADMISSION</strong></td><td><strong>CONTACT</strong></td><td><strong>DATE</strong></td></tr><tr><td>101</td><td>1</td><td>Sean Wright</td><td>2017</td><td>9867435573</td><td>1999/10/20</td></tr><tr><td>102</td><td>2</td><td>Ken Wilson</td><td>2018</td><td>3546587556</td><td>2000/11/19</td></tr><tr><td>103</td><td>3</td><td>Robert Harris</td><td>2018</td><td>6476585648</td><td>2000/03/07</td></tr></table><p><strong>_ID</strong> <strong>_NO</strong> <strong>_NAME</strong> <strong>_YEAR</strong> <strong>_NO</strong> <strong>_OF_BIRTH</strong></p><p><strong></strong></p><p><strong>Explanation:</strong></p><p></p><p>Here each record in the Student Table represents a Student Object or Entity which exists in real-time. All the records together represent an Entity Set i.e Student Table. So, we see there are 3 entities in the above table. We see for the Student Entities with names ‘Ken’ and ‘Robert’ the <strong>ADMISSION_YEAR</strong> is the same but they are uniquely identifiable because of their STUDENT_ID and ROLL_NO. Hence, this makes the Student Table a <strong>Strong Entity Set</strong>.</p><p></p><p>Now, a Weak Entity is dependent on another entity. So in databases, we represent weak entities that reference other tables or parent tables. In simpler terms, a weak entity has a key that refers to the primary key of another table to exist. Such keys are called <strong>Foreign Key</strong>.</p><p></p><h3>Attribute</h3><p></p><p>An attribute describes the characteristics or properties of an entity. Like all entities combine to form an Entity Set, similarly a fixed set of attributes combining define an entity type. For each entity, certain properties describe them and even help to uniquely identify the entities. For Example, In the above Student Table, each column or value like the STUDENT_ID, ROLL_NO, STUDENT_NAME, etc are the attributes that define each Student Entity. Each attribute in a table accepts a set of values over a certain <strong>domain</strong>. In an entity, each attribute is allowed to have only one value which could be a number, text, date, etc. (defined in respective SQL Database Server )In simpler terms, every column header in a table is an Attribute.</p><p></p><p><img src="https://www.thecrazyprogrammer.com/wp-content/uploads/2021/09/Screenshot-217-1024x537.png" alt="" class="fr-fic fr-dii fr-draggable " style="" /></p><p></p><h4>Attribute Types</h4><p></p><p>Hence, there are different types of attributes that define an entity:</p><p></p><ul> <li data-xf-list-type="ul"><strong>Simple Attribute:</strong> This attribute cannot be divided any further into its subtypes. These attributes can contain Null values. Ex: In the above table, STUDENT_ID and ROLL_NO are simple attributes.</li> <li data-xf-list-type="ul"><strong>Composite Attribute:</strong> Composite Attributes are a combination of more than one attribute or simple attributes. Ex: In the Student Table the STUDENT_NAME Column can be subdivided consisting – FIRST_NAME, MIDDLE_NAME, LAST_NAME that can collectively form a name of Student. Similarly, there can be an Address Column for a Composite Attribute having City, Street, and PinCode Columns.</li> <li data-xf-list-type="ul"><strong>Single Valued Attribute:</strong> These attributes allow only one or a single value. These attributes are different from Simple Attributes and usually form the key or Primary Key which uniquely identifies an entity. For an entity, there cannot be multiple values for this column or attribute. For Ex: STUDENT_ID and ROLL_NO are unique and Single Valued attributes in Student Table.</li> <li data-xf-list-type="ul"><strong>Multi-Valued Attribute:</strong> These attributes can contain more than one value at a time. It can be a composite attribute. Ex: The CONTACT_NO Column in Student Table has only one value for each entity, but it can be Multi-Valued as a student can have more than one Contact Number.</li> <li data-xf-list-type="ul"><strong>Derived Attribute:</strong> The derived attribute are those attributes that may or may not exist in the physical database. Its value gets derived from other attributes, or we can say that it depends on other database attributes for the data. Ex: In the Student Table we have Column DATE_OF_BIRTH through which we can derive an Attribute <strong>AGE</strong> by getting the current date. So AGE can be an example of a Derived Attribute. distinguish</li> </ul><h2>Difference between Entity and Attribute</h2><p></p><p>Now, let’s summarize the key differences between an Entity and an Attribute.</p><p></p><table style='width: 100%'><tr><td><strong>Criteria Specification</strong></td><td><strong>Entity</strong></td><td><strong>Attribute</strong></td></tr><tr><td><strong>Definition</strong></td><td>It is a distinguishable object having a real-time existence.</td><td>It is the property that defines the elementary structure of an entity type.</td></tr><tr><td><strong>ER Model Representation</strong></td><td>In ER Model we represent an entity in a Rectangular Box.</td><td>In ER Model we represent an Attribute in an Oval Bounded Region.</td></tr><tr><td><strong>Table Representation</strong></td><td>Each row or record in a table is treated as an entity.</td><td>Here, each column header defines an attribute.</td></tr><tr><td><strong>Types</strong></td><td>Entities are generally of two types: Strong Entity and Weak Entity.</td><td>Attributes are generally of 5 types: Simple, Composite, Single-Valued, Multi-Valued, Derived.</td></tr><tr><td><strong>Use</strong></td><td>A group of entities defines an Entity set, represented in the database using tables.</td><td>A group of attributes identifies an entity and usually forms the Key in the table.</td></tr><tr><td><strong>Functionality</strong></td><td>Entities represent the main objects of the RDBMS.</td><td>Attributes represent the characteristics or standards to define an entity.</td></tr></table><p></p><p>So, that’s all about the article we had a detailed look at each topic and summarized the key differences between them.</p></blockquote><p></p>
[QUOTE="Code55, post: 28, member: 14"] In this article, we will have a look at the difference between Entity and Attribute, which form the core principles of the Entity-Relationship Model in Database Management System. We will look at the description of each in detail with examples and compare them for a clear idea. [HEADING=2]Entity[/HEADING] An Entity is defined as any object which has a real-time existence. Moreover, an object is only considered as an Entity if it is easily identifiable among all other objects. In the context of DBMS an entity typically represents data in an [URL='https://www.thecrazyprogrammer.com/2017/03/difference-between-dbms-and-rdbms.html']RDBMS[/URL]. It is an object about which we store or retrieve data from the database. Now, the entities that share the same set of properties coalesce into an [B]Entity Set[/B]. We represent an entity set as a relation or a table in Relational Database Management System. So, Each row in a table represents an entity and the table itself represents an entity set. Therefore, to maintain integrity and avoid ambiguity, it is essential that all entities (rows) are unique and must not be replicas of each other. [HEADING=3]Entity Types[/HEADING] There are in general two types of entities: [LIST] [*][B]Strong Entity: [/B]A Strong Entity is an entity that does not depend on another entity. In the context of RDBMS, a Strong Entity contains the Primary Key of the Table. In ER Model we represent a Strong Entity via a Rectangular box. [/LIST] [IMG]https://www.thecrazyprogrammer.com/wp-content/uploads/2021/09/Screenshot-213.png[/IMG] [LIST] [*][B]Weak Entity: [/B]A Weak Entity is one that always depends on another entity or parent entity. Hence, it has no Primary Key to uniquely identify it in the table. A doubly rectangular box usually represents a Weak Entity in ER Model. [/LIST] [IMG]https://www.thecrazyprogrammer.com/wp-content/uploads/2021/09/Screenshot-218.png[/IMG] Now, let us understand the above-discussed points with some examples. Suppose we have a table Student which contains the following records: [TABLE] [TR] [TD][B]STUDENT[/B][/TD] [TD][B]ROLL[/B][/TD] [TD][B]STUDENT[/B][/TD] [TD][B]ADMISSION[/B][/TD] [TD][B]CONTACT[/B][/TD] [TD][B]DATE[/B][/TD] [/TR] [TR] [TD]101[/TD] [TD]1[/TD] [TD]Sean Wright[/TD] [TD]2017[/TD] [TD]9867435573[/TD] [TD]1999/10/20[/TD] [/TR] [TR] [TD]102[/TD] [TD]2[/TD] [TD]Ken Wilson[/TD] [TD]2018[/TD] [TD]3546587556[/TD] [TD]2000/11/19[/TD] [/TR] [TR] [TD]103[/TD] [TD]3[/TD] [TD]Robert Harris[/TD] [TD]2018[/TD] [TD]6476585648[/TD] [TD]2000/03/07[/TD] [/TR] [/TABLE] [B]_ID[/B] [B]_NO[/B] [B]_NAME[/B] [B]_YEAR[/B] [B]_NO[/B] [B]_OF_BIRTH Explanation:[/B] Here each record in the Student Table represents a Student Object or Entity which exists in real-time. All the records together represent an Entity Set i.e Student Table. So, we see there are 3 entities in the above table. We see for the Student Entities with names ‘Ken’ and ‘Robert’ the [B]ADMISSION_YEAR[/B] is the same but they are uniquely identifiable because of their STUDENT_ID and ROLL_NO. Hence, this makes the Student Table a [B]Strong Entity Set[/B]. Now, a Weak Entity is dependent on another entity. So in databases, we represent weak entities that reference other tables or parent tables. In simpler terms, a weak entity has a key that refers to the primary key of another table to exist. Such keys are called [B]Foreign Key[/B]. [HEADING=2]Attribute[/HEADING] An attribute describes the characteristics or properties of an entity. Like all entities combine to form an Entity Set, similarly a fixed set of attributes combining define an entity type. For each entity, certain properties describe them and even help to uniquely identify the entities. For Example, In the above Student Table, each column or value like the STUDENT_ID, ROLL_NO, STUDENT_NAME, etc are the attributes that define each Student Entity. Each attribute in a table accepts a set of values over a certain [B]domain[/B]. In an entity, each attribute is allowed to have only one value which could be a number, text, date, etc. (defined in respective SQL Database Server )In simpler terms, every column header in a table is an Attribute. [IMG]https://www.thecrazyprogrammer.com/wp-content/uploads/2021/09/Screenshot-217-1024x537.png[/IMG] [HEADING=3]Attribute Types[/HEADING] Hence, there are different types of attributes that define an entity: [LIST] [*][B]Simple Attribute:[/B] This attribute cannot be divided any further into its subtypes. These attributes can contain Null values. Ex: In the above table, STUDENT_ID and ROLL_NO are simple attributes. [*][B]Composite Attribute:[/B] Composite Attributes are a combination of more than one attribute or simple attributes. Ex: In the Student Table the STUDENT_NAME Column can be subdivided consisting – FIRST_NAME, MIDDLE_NAME, LAST_NAME that can collectively form a name of Student. Similarly, there can be an Address Column for a Composite Attribute having City, Street, and PinCode Columns. [*][B]Single Valued Attribute:[/B] These attributes allow only one or a single value. These attributes are different from Simple Attributes and usually form the key or Primary Key which uniquely identifies an entity. For an entity, there cannot be multiple values for this column or attribute. For Ex: STUDENT_ID and ROLL_NO are unique and Single Valued attributes in Student Table. [*][B]Multi-Valued Attribute:[/B] These attributes can contain more than one value at a time. It can be a composite attribute. Ex: The CONTACT_NO Column in Student Table has only one value for each entity, but it can be Multi-Valued as a student can have more than one Contact Number. [*][B]Derived Attribute:[/B] The derived attribute are those attributes that may or may not exist in the physical database. Its value gets derived from other attributes, or we can say that it depends on other database attributes for the data. Ex: In the Student Table we have Column DATE_OF_BIRTH through which we can derive an Attribute [B]AGE[/B] by getting the current date. So AGE can be an example of a Derived Attribute. distinguish [/LIST] [HEADING=1]Difference between Entity and Attribute[/HEADING] Now, let’s summarize the key differences between an Entity and an Attribute. [TABLE] [TR] [TD][B]Criteria Specification[/B][/TD] [TD][B]Entity[/B][/TD] [TD][B]Attribute[/B][/TD] [/TR] [TR] [TD][B]Definition[/B][/TD] [TD]It is a distinguishable object having a real-time existence.[/TD] [TD]It is the property that defines the elementary structure of an entity type.[/TD] [/TR] [TR] [TD][B]ER Model Representation[/B][/TD] [TD]In ER Model we represent an entity in a Rectangular Box.[/TD] [TD]In ER Model we represent an Attribute in an Oval Bounded Region.[/TD] [/TR] [TR] [TD][B]Table Representation[/B][/TD] [TD]Each row or record in a table is treated as an entity.[/TD] [TD]Here, each column header defines an attribute.[/TD] [/TR] [TR] [TD][B]Types[/B][/TD] [TD]Entities are generally of two types: Strong Entity and Weak Entity.[/TD] [TD]Attributes are generally of 5 types: Simple, Composite, Single-Valued, Multi-Valued, Derived.[/TD] [/TR] [TR] [TD][B]Use[/B][/TD] [TD]A group of entities defines an Entity set, represented in the database using tables.[/TD] [TD]A group of attributes identifies an entity and usually forms the Key in the table.[/TD] [/TR] [TR] [TD][B]Functionality[/B][/TD] [TD]Entities represent the main objects of the RDBMS.[/TD] [TD]Attributes represent the characteristics or standards to define an entity.[/TD] [/TR] [/TABLE] So, that’s all about the article we had a detailed look at each topic and summarized the key differences between them. [/QUOTE]
Insert quotes…
Verification
Post reply
Richest Freecoded User
Most Freecoin
freecoded
4,876 Freecoin
J
Johnhendrick
645 Freecoin
S
Smith16
607 Freecoin
Davy200
590 Freecoin
nathan69
426 Freecoin
Laureine
415 Freecoin
A
anajeen
395 Freecoin
P
Peterparker87
331 Freecoin
C
codeguru
282 Freecoin
Tekera
267 Freecoin
Home
Forums
DATABASE CODING
SQL
How to diffrientiate between Entity and Attribute
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.
Accept
Learn more…
Top